FlexGrid - Call rowEditEnding manually for each row when grid loads with data

Posted by: sandeep.a.kurup on 8 July 2020, 12:32 am EST

  • Posted 8 July 2020, 12:32 am EST

    I am using the flex grid and in “rowEditEnding” event, I wrote a custom validation method that will set a “valid flag” and “error message” to the row item. The grid will show an error icon if the valid flag of the item is set to false.

    How can I call this method manually when the grid loads with invalid data for each row? So that I can set this flag and show the error icon when the grid loads?

    (Currently, if the grid have existing invalid data, the flag sets and display the error icon only after we do any changes in row data)

  • Posted 8 July 2020, 5:25 pm EST

    Hi Sandeep,

    Instead of calling the rowEditEnded method, I would suggest you create a different method for adding the flag and call this method on each row by handling the loadedRows event and the rowEditEnded event.

    function addFlag(row) {
    	// ....
    }
    
    grid.rowEditEnding.addHandler.((s, e) => addFlag(e.row));
    grid.loadedRows.addHandler((s, e) => {
    	// iterate over each row and add the flag
    	grid.rows.forEach(r => addFlag(r.index)):
    });
    

    The loadedRows event is fired whenever the rows are bound to the grid. For example, when the data source is set or the grid is sorted.

    Regards,

    Ashwin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels