Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by john on Oct 13, 2008 03:19
open dhtmlx forum
an question about the data validation and number format.

Dear Support Team,



I have an question about the data validation and number format.

First, when the user enter non-num value, the value should be converted to zero. It is support by set mygrid.setColTypes( dyn)

However , we want to set number format by mygrid.setNumberFormat("0,000.00",i). mygrid.setColTypes( dyn) doesn't support setNumberFormat method.

How can the grid convert NaN into zero or orginal number and set number format simultaneously??? Thank





Best Regards

John Chan
Answer posted by Support on Oct 13, 2008 04:12
You can use setNumberFormat and define a custom rule through onCellChanged event

grid.attachEvent("onCellChanged",function(id,ind,value){
    if (ind = INDEX && (val != val || val=="NaN"))   this.cells(id,ind).cell.innerHTML="0";
});

where INDEX - index of column in question
Answer posted by john on Oct 13, 2008 04:36

how can i change the color of  some certain rows and columns? such as the subtotal row  containing in <row class="sub_total" id="sub1"> in xml   or change color of all the editable columns???Thx

 

 

 

 

Answer posted by Support on Oct 13, 2008 04:58
If you need to change bg color of row you can use

grid.setRowColor(row_id, "red");
or
grid.setRowTextStyle(row_id, "background-color:red;");

>>or change color of all the editable columns???
You can set style for any necessary column by setCellTextStyle method
Colors of columns can be defined during grid initialization