I am using a combo in a Column in grid.
The options in combo are 1|coke,1|soda,2|chips,
If I click a option in combo, I want to show only number in grid.
For Example, if I choose 1|coke, I only want to show 1 in that cell.
if I choose 2|chips, I only want to show 2 in that cell.
What should I do?
Or which event should I use?
You can use “onFilterStart” to catch when filtration has been started and then call filterBy() method to filter grid by necessary value. Please find more information here docs.dhtmlx.com/doku.php?id=dhtm … ilterstart
Do you have any examples of “onFilterStart” Event combine with FilterBy method?
grid.attachEvent(“onFilterStart”, function(indexes, values){
values[0]=values[0].split("|");
return true;
});
Above code will convert filter string as “1|coke” to the “1” and will use “1” for filtering.
grid.attachEvent(“onFilterStart”, function(indexes, values){
values[0]=values[0].split("|");
return true;
});
mygrid.filterBy(4,function(indexes, values){
values[0]=values[0].split("|");
return true;
});
Is not working.
What should I do with filterBy()?
If I define filterBy function, do I still need to use onFilterStart?
mygrid.filterBy(4,function(data){
var myAry=data.split("/");
return data=myAry[0];
});
Seems not to work.
Please help me.
Above code will convert filter string as “1|coke” to the “1” and will use “1” for filtering.
How to do it?
Could you help me please.please.
Thank.
I have solve the problem.
I remove all the comboOptions when I need to show only the value.
mygrid.attachEvent(“onEditCell”,function(stage,rId,cIndex){
if(stage==0 )
{
mygrid.getCombo(4).restore();
}
if(stage == 2 && cIndex==4){
var myAry=mygrid.cells(rId,4).getText().split("/");
combo.remove(1);
combo.remove(2);
combo.remove(3);
combo.remove(0);
return myAry[0];
}
else{
return true;
}
});