i wrote this function to symply show an up-Arrow or down-Arrow replacing the value number normally sorted descendant.(the number could be also negative):
The function shows correctly the arrows, that initially are sorted by the sql query, but if i try to change the order o returning to descendant after sorting other columns the order is not correct and strange, while i should want show Arrows but mantaining the sort order based on original values.
I apologize for the delay with the answer to you.
The sorting functions sort the column by the value of the cell.
In your case you need to create your own custom sorting type.
Here you can find a tutorial with some examples: docs.dhtmlx.com/grid__sorting.ht … ngfunction
I thought that building a custom excell should permit to control also ordering passing the correct value to getValue function but i don’t know how, doesn’ it ?
The sorting in the grid uses the cell values in any any kind of exCell. You should organize the value of your cell in your custom exCell or create a custom sorting type.
In the provided example i don’t us any specific API.
function excell_roncli(cell) {
if (cell) {
this.cell.= cell;
this.grid = this.cell.parentNode.grid;
}
this.edit = function() {}
this.isDisabled = function() { return true;}
this.setValue = function(val) {
// saving the original value of your cell before the formatting to any custom variable
this.cell.real_value = val;
if (val>=0) {
this.setCValue("<img src='icons/up_small.gif'/>", val);
}
else {
this.setCValue("<img src='icons/up_down.gif'/>", val);
}
}
this.getValue=function(){
//return the saved value in the getValue() function
return this.cell.real_value;
}
}
eXcell_roncli.prototype = new excell;
this.cell.real_value is a custom property, created on the fly to save the needed value.
You may replace it with “this.cell.my_value”, “this.cell.some_needed_value”, etc. there is no matter.