Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Kovtun D on Jan 29, 2009 14:09
open dhtmlx forum
How to establish initial value #select_filter?

Hello.
My table: http://server030.serverquality.com / ~ kovtun/table /

It is necessary, that primary value 3 columns was "eurusd" and in any way differently.
And initial value 2 columns = "Forex"
As it to make?

Thanks.
Answer posted by Support on Jan 30, 2009 01:01
>>And initial value 2 columns = "Forex"
There is no API to set values of built-in filter boxes, but if you know the structure of header you can access the element directly through DOM  and set it as
mygrid.load(url,function(){
         grid.hdr.getElementsByTagName("SELECT")[0].value="Forex";
},"csv");

>>It is necessary, that primary value 3 columns was "eurusd" 
The list of options built from the loaded data and sorted in ASC order by default. 
You can 
  a) use custom select in input instead of built in fitler
  b) modify existing code to change the logic of options order

dhtmlxgrid_filter.js 
dhtmlXGridObject.prototype.collectValues=function(column){
...
    return f.sort();            
}


can be changed as

     f.sort();
     if (column == 2 ) f.shift("eurusd"); //adding first parameter for 3rd column
     return f;
}


Answer posted on Jan 30, 2009 03:34
Hello.
This code has changed only the name, but sorting has not occurred.

mygrid.load (url, function () {mygrid.hdr.getElementsByTagName ("SELECT") [0].value = "Forex";}, "csv");

Other code which you have given, kills all table and it ceases to work. In my table constant values are known is "Forex" (2 column) and "EURUSD" (3 column). It is impossible to put them instead of empty fields which arise at page loading? That sorting was at once on these values...