Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
695
Cancel Client Side RowUpdate?
posted

The problem I am having is I tried using the BeforeCellUpdate with a grid that allows you to enter new rows.  Everytime a new row is entered in to the grid the BeforeCellUpdate fires a bunch of times to render the new row and then clear out the Enter row.  Also, the problem I am having is the validation I am doing on the cell is maintaining unique Id's.  If the inputted data in the cell matches another cell than I do not want to update this new cell.

Is there anyway that I can cancel a cell update on the client side?  I have to do validation on my newly entered values in current rows or in the enter row.  I am checking two column values and you would think this would be relatively simple but with the BeforeCellUpdate event is firing too many times and screwing up my validation. 

 

Wondering if anyone has run in to this problem yet?  Any help would be greatly appreciated

  • 90
    posted

    So to rephrase your problem, you want to prevent data being entered in a row if that data would conflict would data already in other rows in the grid.

    And specifically you want to even prevent data being entered in a cell if that would conflict with data in another cell?

    Have you looked at the online examples at http://samples.infragistics.com/2008.2/webfeaturebrowser/default.htm?

    This function would tell you if the value entered already exists in the grid anywhere.  

    valueExistsAlready(strField, strValue)
    {   
        var regExp= new RegExp("^"+strValue + "$", "gi");
        var oCell = igtbl_getGridById("yourGridNameHere").Bands[0].getColumnFromKey(strField).find(regExp);
        if (oCell != null)
            return true;
        else
            return false;
    }

    You can also cancel the update of a cell by returning true in the BeforeCellUpdate event if you find that the value doesn't meet your validation criteria.  Finally since the cell update event gets told the cell that the update occured in, you just have to look for the field name you want to validate and ignore all the rest.