Stránka 11

Menu Favourites and script for the list of records

PříspěvekNapsal: ned 06. pro 2015 11:02:10
od andesys
(Translated from another language)
I think menu Favourites does not work correctly. Or at least it works in a different way than I would expect. I have set default filtering at display of class records by the help of script and it works properly. However, if I change the filter and save a link in Favourites, my filter from the moment when I was saving the link is not shown when opening the link from Favouties again. Instead the default filter from the script is shown again. When I did not use this filter, the link from Favourites worked well with the particular filter. It is a bug in my view. What to do with that? I do not want to cancel the default filter in the class because it is helpful.

Re: Menu Favourites and script for the list of records

PříspěvekNapsal: ned 06. pro 2015 11:03:50
od andesys
Include following condition in the script in the class: ( !OGForm.QueryString.Exist('filter')).
Code example:
Kód: Vybrat vše
function OnLoad()
{
  if ( !OGForm.Page.IsPostBack)
  {
    if ( !OGForm.QueryString.Exist('filter'))
      {
       OGFilter.Clear();
       OGFilter.Add( true, 'column_code', '=', 100);
       OGFilter.Run();
      }
  }
}

The line with OGFilter.Add() should be adapted according to what you need (or you can add other lines depending on how complex your condition is).

This behaviour is described as an example in the documentation: http://doc.objectgears.cz/Help.aspx?H=a_og_examples_quick_filter