How to do the automatic choice of value at sorting?

Hello.

It is necessary to me, that at page loading my table has been sorted by the name “eurusd”.

I.e. that value in the dropping out menu of sorting in 3 column - “EURUSD” was automatically exposed.

I changed a code in a file dhtmlxgrid_filter.js, but it has turned out nothing! = (

Was so:

dhtmlXGridObject.prototype.collectValues=function(column){if (this.isTreeGrid()) return this.collectTreeValues(column);

this.dma(true)

this._build_m_order();

column=this._m_order?this._m_order[column]:column;var c={};

var f=[];var col=this._f_rowsBuffer||this.rowsBuffer;

for (var i=0;i<col.length;i++){var val=this._get_cell_value(col[i],column);

if (val && (!col[i]._childIndexes || col[i]._childIndexes[column]!=col[i]._childIndexes[column-1])) c[val]=true};

this.dma(false)

var vals=this.combos[column];for (d in c)if (c[d]===true)f.push(vals?(vals.get(d)||d):d);return f.sort();}



Became so:

dhtmlXGridObject.prototype.collectValues=function(column){if (this.isTreeGrid()) return this.collectTreeValues(column);

this.dma(true)

this._build_m_order();

column=this._m_order?this._m_order[column]:column;var c={};

var f=[];var col=this._f_rowsBuffer||this.rowsBuffer;

for (var i=0;i<col.length;i++){var val=this._get_cell_value(col[i],column);

if (val && (!col[i]._childIndexes || col[i]._childIndexes[column]!=col[i]._childIndexes[column-1])) c[val]=true};

this.dma(false)

var vals=this.combos[column];for (d in c)if (c[d]===true)f.push(vals?(vals.get(d)||d):d);f.sort();

if (column == 2 ) f.shift(“EURUSD”); //adding first parameter for 3rd column

return f;}



I understand a language badly. Tried many different variants. Tell, please, in what my error?

In advance thanks.

The solution with code modification was necessary if you need to have the option in question a first option in list
If you just need to have some options preselected in filter box after grid loading , you can use code similar to next

mygrid.loadXML(“500.xml”,function(){
mygrid.hdr.getElementsByTagName(‘SELECT’)[0].value=“John Grisham”; //set value of first selectbox in header, in your case index and value will differe
mygrid.filterByAll(); //force filtering in grid by entered value
});

Working sample sent by email.

Thanks a lot!