Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Gonçalo Neves on May 02, 2008 10:38
open dhtmlx forum
rows compare

Hi,

I need to know how to compare my new row with entire grid because, i shoulldn't insert repeated records...



Answer posted by Support on May 03, 2008 01:41
The most simple way - compare by ID.
Each row in grid must have unique ID , and you can check if row with such ID already exists by
    if(grid.getRowById("someID")) alert("alredy exists");

The less reliable way - compare by cell value

    if (grid.findCell(value,INDEX).length) alert("cell with such value already exists");

where
    value - cell value
    INDEX - column