I would have thought this to be simple. I need to, on leave of the cell, trap an event, and make an ajax call ( an item lookup) and upon return load other cells in the row with the results of that lookup.
I have found I can only hook into the blur and valueChanged events which. Those don't seem to be grid events. Also, in valueChanged I need to save off the row index so that my ajax response set the other cells for the current row...however it seems activeRow and activeCell are not set in the grid object.
I have messed with the updating mode and selection mode but neither of these seem to help.
Can someone share a solution?
Update: I am able to get the activeRow (athough I wonder why it's index is 2 when I am adding the first row)
However, I get this message "Uncaught Error: cannot call methods on igGridUpdating prior to initialization; attempted to call method 'setCellValue'"
When I try in the ajax sucess handler: grid.igGridUpdating('setCellValue',idx,'description',data.results[0].description);
Hi timjnelson,
Thank you for posting in our forums. I have a questions regarding your scenario: what is the editing mode that you are using: row or cell mode? In row mode you can use the editor’s blur event as you discovered already. From there you can get the data-id attribute of the row ( the TR element) which holds the primary key value of the row. And after that you can use this value for setCellValue and update the other editors with the desired data. I’m attaching a sample page that demonstrates my suggestion. Please check it and let me know if it works for you.
I’m looking forward to your reply.
Kind regards,
Petko Zhekov
Software Engineer
It appears the issue stems from putting the grid in a DIV tag vs. a TABLE tag. I don't get the error when I use a TABLE. Why the difference?
Hello timjnelson,
Please do not hesitate to contact me if you have any further questions regarding this scenario.
Thank you for your reply.
When a DIV is used as the grid's target element, the main grid table is instantiated in that div. That inner table is used by the grid's widget (and the feature widgets) use that inner table as opposed to the div element. Therefore it is useful to use the id() and widget() methods prior to manipulating an igGrid with a div target.
When a table is used as the target of the igGrid, these issues do not apply as the table itself is used as the main grid table.
Hope this helps. Please do not hesitate to contact me if you have any questions.