Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Raj on May 12, 2008 23:12
open dhtmlx forum
get column data type & validate the cell on edit in grid

Hi,

I am using DataProcessor with grid,
I am displaying the grid with different column names and its types dynamically,
like I am displaying different Database tables in the grid based on selection criteria.

Here I would like to validate the column when onCellEdit with respect to the column type which I got dynamically from server side,
So is there a way to get the column data type dynamically and check the value respect to the type and alert an error message?

/Thanks
Raj
Answer posted by Support on May 13, 2008 09:36
It technically possible, you can get column type as
    grid.getColType(ind)

    grid.attachEvent("onEditCell",function(stage,id,ind,value){
       if (stage==2) {
          var type = this.getColType(ind)
          if (!some_check(value,type)) {
                alert("incorrect data");
                return false;
          }
       }
       return true;
    })