Title: cant get changed rows from datagrid [solved] Post by: devnull on February 27, 2013, 09:09:08 PM This always returns 0 even though changes have been made to the rows.
Code: var dg = $(this).datagrid('acceptChanges'); The datagrid mode changes correctly after the acceptChanges(), however the getChanges() never seems to work. Title: Re: cant get changed rows from datagrid Post by: stworthy on February 27, 2013, 11:15:02 PM The 'acceptChanges' method commit all the changed data and 'getChanges' method return changed rows since the last commit. Calling 'getChanges' after 'acceptChanges' will return no rows. To get the changed rows, try the following code:
Code: //var dg = $(this).datagrid('acceptChanges'); Title: Re: cant get changed rows from datagrid Post by: devnull on February 27, 2013, 11:59:05 PM Thanks, I tried that, still no records returned:
Code: // Is this a Datagrid ?? Title: Re: cant get changed rows from datagrid Post by: stworthy on February 28, 2013, 01:21:06 AM Here is the row editing example http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=Row%20Editing%20DataGrid.
Edit some rows and then click the 'GetChanges' button. It will tell you the changed rows count. Title: Re: cant get changed rows from datagrid Post by: devnull on February 28, 2013, 02:34:17 AM Thanks, I did that it does work when you select another row after editing the first, but not when you tab between the columns on the same row.
But what are the specific datagrid events that need to happen for the getChanged() function to work ?? 1) selectRow() 2) beginEdit() 3) endEdit() 4) getChanged() This is what I am doing now, I suspect there is a step missing ?? Many Thanks Title: Re: cant get changed rows from datagrid Post by: devnull on February 28, 2013, 02:58:31 AM OK, I have figured it out, you have to endEditing on each row, you cannot just endEditing for the whole datagrid.
This won't work: Code: $(this).datagrid('endEdit'); This does work: Code: $(this).datagrid('endEdit',editIndex); Thanks again. |