Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tony on Apr 11, 2008 13:34
open dhtmlx forum
Filtering Grid on load via userdata tag value

Hi,

First some background...

I have a page which will contain tabs that are powered by the Prototype framework. Each tab will need to contain an instance of the Grid with the results from the initial XML file filtered by a value from the onClick of the tab link.

Basically, we have the XML being loaded with the page and the default tab which will show results in status "Active". We need the Grid to be filtered on load for only Active records. The other tabs will be "Draft" and "Inactive" and will also filter the Grid when they are selected. I want to do this so we don't have to address the server with each tab change.

Is there a way to do this by using the <userdata> tag that we can include in the XML? I don't want the Status field to show as a column in the Grid but I do want to filter by it.

Is this possible?

Thanks in advance.
Answer posted by Support on Apr 14, 2008 01:59
>>Is there a way to do this by using the <userdata> tag that we can include in the XML?
It possible to filter grid dataset by custom rule, but in any case the filtering will occur based on cell values , not on userdata.

You can use one of next workaround

a) use hidden column
    you can load status data as separate column and use
       grid.setColumnHidden(....
    to make column hidden, it will be operable by API, including filterBy command, but will not be vissible|accessible to user.

b) you can update existing code of grid to change how filtering works
    dhtmlxgrid_filter.js
        if (d?(e.getValue().toString().toLowerCase().indexOf(value)==-1):(!value(e.getValue()))){
    can be replaced with
       if (this.getUserData(this.rowsCol[i].idd,"name_of_user_data")!=value){