Hi,
I am trying to create a column that is editable numeric field.
Based on the other column field, I would like to change the type.
For example, if the column_1 = ‘Percentage’
then I want my custom_column to show 99.99 suffixed with ‘%’ sign.
else for any other column_1 values, just show a numeric value with 2 decimal places.
My logic is:
function eXcell_myedn(cell) {
this.base = eXcell_edn;
this.base(cell);
this.setValue = function(val) {
if (!val || val.toString()._dhx_trim() == "")
val = "";
else {
val = val + "%";
this.cell.innerHTML = this.grid._aplNF(val, this.cell._cellIndex);
}
}
}
eXcell_myedn.prototype = new eXcell_edn;
My grid initialization looks like:
grid.setColTypes(“ro,ro,ro,ro,myedn”);
grid.attachEvent(“onCellChanged”, function(id, ind, value) {
if (ind == 6) {
var metricType = grid.cellById(id, 3).getValue();
grid._ignore_next = true;
if (metricType == "Percentage" && value) {
grid.setCellExcellType(id, ind, "myedn");
}
if (!value || value.toString()._dhx_trim() == "0.00" && metricType != "Percentage")
grid.setCellExcellType(id, ind, "ed");
grid._ignore_next = false;
}
});
The following logic doesn’t work and ‘%’ sign does not get suffixed at the end of a Floating value in my column.
any help would be appreciated.