Coltype="edn" functionality


I am currently using the pro version of dhtmlxgrid.

While defining the grid, I am setting the column type for 1 of my column as “edn”.

Then setting the number format for that column.
Here is the sample code:

grid = new dhtmlXGridObject('gridBox');
grid.setNumberFormat("0,000", 2);

The column is functioning properly, in terms of the number format I want. Commas are also displayed correctly.

But when I enter a value with alphabets other than numbers, the value is edited automatically.
For Eg:
If i enter “123abc4” and click any other cell, i get “123” in the original cell.

All the integers to the right of the alphabets “abc” are getting erased automatically.
Is this the default functioning of the “edn” coltype??
If yes, then how can I disable this functionality??
Actually I have my own JS function for checking numeric values, and I want to use that every time a cell is edited. No automatic pruning of values should happen.


edn and ron type will accept only valid numbers as input, they will reject any non-numerical info.

You can use any editor type (ed for example) and call your custom formatting logic from onEditCell stage 2 event , or onCellChanged event

grid.attachEvent("onCellChanged", function(id, ind, value){ if (ind == INDEX && !grid._ignore_next){ grid._ignore_next = true; grid.cells(id, ind).setValue( custom_formating(value)); grid._ignore_next = false; } });

where INDEX - index of column in question

Thanks a lot for the reply.

I think i framed my question incorrectly.

I want to use the comma separated number format for that particular column. And I think you can use “setNumberFormat” function only for “edn/ron” columns?

So what I want is, to use the number format functionality, but avoid the automatic pruning of non numerical values.
Can this be done?

My main constraint is the comma separated number format.

but avoid the automatic pruning of non numerical values.
It is part of number formatting functionality. You can disable only part of it.