jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Saving data after modifying in the grid
Tagged: javascript datagrid, jquery grid plugin
This topic contains 4 replies, has 2 voices, and was last updated by Shankar 11 years, 3 months ago.
-
Author
-
Hi
Can we save data to the database with the help of jqxAdapter that is bound to a grid when the grid data is modified? Or is that the jqxAdapter is only responsible for data binding to the grid to show the grid with data and the save should happen from the grid call back functions?
if it is possible to save data from adapter then if some cell data is changed in the grid can the jqxAdapter be notified that the data is changed and once the adaper process the data can the grid get a response back from the adapter whether to call commit with true or not?Thanks
Hi Shankar,
jqxDataAdapter is responsible for the binding. For saving data to your DB, you can use the jQuery’s Ajax function: https://api.jquery.com/jQuery.ajax/. To get all rows from jqxGrid, you can use the “getrows” method.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter
Thanks a lot for your reply. I have a few more questions/doubts though. I have gone through the documentation and demos but couldn’t find much information for the following.
1.what is the importance of autoBind property of adapter and the difference when it is set to true? I have seen some thread where it was said to call “dataBind” method , but will that be automatically called when we ae using jqGrid?
2.When I modify a cell in the grid and if I didn’t call commit(true) in the updaterow method , the cell value will be updated in the grid records and not the dataadapter records?
3.when I do a save using ajax by getting the records from the grid using “getrows” method then at this point the data adapter records will have stale data( when I dont call commit(true) )?To bind the adapter with the updated data all that I need to is to call “dataBind” method to make call to server and bind fresh data?
4.If I call commit(true) in the “updaterow” method then whatever data I have modified in the grid records will be in sync with the data adapter and while saving I can use either grid records or data adapter records. Am I right?Thanks
Hi Shankar,
1. This help topic is about Data Binding with jqxGrid: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm. I suggest you to read it.
2. jqxGrid does not modify the dataAdapter’s records.
3. To perform a new data binding using the same data source, use the Grid’s updateboundadata method.
4. When you call commit with parameter true, that confirms the row changes. Synchronization should be implemented by you i.e you should make Ajax call to your server and update the DB Record. That does not affect the dataAdapter’s records as well.Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter
Thanks for your quick response.
-
AuthorPosts
You must be logged in to reply to this topic.