Hi Team,
Please refer the attached image.
I have a webdata grid with 3 columns and editor providers where ever applicable.
On modifying any record and clicking save is hitting the rowUpdate on editing.commit()
On new row addition,after entering/selecting values in the 'Add New Row' area when I am clicking save, it is not hitting the rowAdding event..
Any idea on how this can be achieved ?
Regards
Varun
Hello Varun,
I am glad that I have managed to help you.
If you need any further assistance with this do not hesitate to contact me.
Hi Denis,
You are awesome..
The js code snippet you shared worked exactly the way I wanted to work..
It is adding the new row and on saving, row add server side event is getting invoked.
Thanks a lot for such a quick and to the point response..
You can add the row to the grid by using _commitRow method of the row adding event.
You can modify the AddRow method as follows:
function AddRow() { var grid = $find('<%= dgkeywords="" clientid="">'); var editing = grid.get_behaviors().get_editingCore(); var rowAdding = editing.get_behaviors().get_rowAdding(); // You can validate row before commiting rowAdding._commitRow(); }
Now the server side RowAdding event will be fired.
Let me know if you need further assistance.
Server side...
On Save button click , I call the following function
function SaveData() {
var grid = $find('<%=dgKeyWords.ClientID%>'); var editing = grid.get_behaviors().get_editingCore();
var editedRows = grid.get_behaviors().get_editingCore().get_editedRows(); var addeddRows = grid.get_behaviors().get_editingCore().get_addedRows();
editing.commit();
}
On updating any row, dgKeyWords_RowUpdating is getting invoked.
but after filling the new record row and clicking save , it is not invoking the dgKeyWords_RowAdding method.
I really need this add new record to be displayed since my grid is dynamic grid and columns varies based on grid selection
ALTERNATE approach:
In the meantime what I did, I removed the add new record and added a client side method to add new row.
But as I mentioned , grid is dynamic in nature, adding the below line in add row function of javascript will not work.
var row = new Array(0, "", "", false);
I need to put if else condition and to add row based on grid data source that will be a huge task.
So I can not go for client side row addition. IT will be good to have new record row visible and user filling and saving it ...
Attaching the codebase for your review..It is in VS2013
On page, select the grid type from dropdown and it will load the grid.. Editing is working fine here.
'Add New' button is to add a new row from client side.
Thank you for contacting Infragistics Developer Support!
Could specify which event row adding event is not being fired the client or the server event.
If you attach a sample project reproducing your issue it will be better.