jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Refresh grid after Updaterow
Tagged: jqxgrid, json, php, refresh grid, update data, updateboundata
This topic contains 5 replies, has 3 voices, and was last updated by syedkhaleel2010 10 years, 5 months ago.
-
Author
-
Hi friends, i’m a newbie with jqwidgets and jquery and i need your help.
My page is structured in this way:
– Grid “A”
– Grid “B”
– Button “Insert”My Grid “A” have a datatype “Json” and i’ve a php page that load rows in the grid. Now, when i modify this data and i push the button “Insert”, i write (with php page) the data in the mysql database. The Grid “B” gets this data at page loads through datatype “Json” and another php page for query and json_encode.
Now, my problem is that: “When i push the button “Insert”, i want to store data on database and update the second grid (Grid B). I’ve tryed with this code on my button:
$("#updaterowbutton").click( (function (event) { var rows = $('#jqxgrid').jqxGrid('getrows'); var nRows = rows.length; var result = ""; for(var i=0; i<nRows; i++) { var row = rows[i]; if (row.qta>0) { result += row.arcodart + ";" + row.ardesart + ";" + row.qta+"|"; } } var xmlHttp = null; xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", "http://localhost/car.php?art="+result); xmlHttp.send( null ); $("#jqcarrello").jqxGrid('updatebounddata', 'cells'); }) );
Unfortunately, the code “$(“#jqcarrello”).jqxGrid(‘updatebounddata’, ‘cells’);” don’t work correctly:
– The first time i press the button, my second grid doesn’t refresh data;
– The second time, and the next time, i press the button my second grid gets the refresh but shows me the old data (the data of my previous operation).If i use another button “only” for refresh, all works fine.
How can i resolve this problem? 🙁Hi oce,
“$(“#jqcarrello”).jqxGrid(‘updatebounddata’, ‘cells’); refreshes the cells only. It refreshes the cell values using the same data source. That is not related to the Grid’s updaterow. If you want to update a row in the Grid, you should use the “updaterow” method of jqxGrid as shown in the Create, Remove, Update example. If you want to update the Grid’s data, then set its “source” property to point to a new instance of jqxDataAdapter. If you want to use the same data source, then call “updatebounddata” without parameters.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter, thank you for your reply!
I’ve the same data source. If i use “$(“#jqcarrello”).jqxGrid(‘updatebounddata’, ‘cells’);” in a new button, i’ve what i want but if i write this code at bottom of the updaterow events code (after php code has worked), the update don’t working.I want to refresh the grid with new value (inserted or edited by php code) but i’ve problem with this step…
I’ve tryed to re-assign a new dataAdapter but the results are the same. I have seen more times the example but i don’t understand how can i integrating it in my code.
I’m sorry but i’m a very newbie, but i want to learn it!
N.B. Sorry for my bad english ^_^
Hi oce,
For making server requests, you should use either jqxDataAdapter or jQuery’s Ajax function. The way you do it now will result in making async request and updating the Grid before the async request is done. I suggest you to look at the jqxGrid’s Documentation help topics, PHP Integration help topics and all the available samples about jqxGrid, PHP Demos, etc. before proceeding with implementation that use the widget.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comOk, thanks.
Hi folks,
I have a jqxGrid with list of data and i am updating the row in a pop up.
when i update the row details in pop up it should refresh only the updated row in the list,without refreshing the Gridis there any Possibility of doing so..
please suggest solutions..
Thanks
Syed -
AuthorPosts
You must be logged in to reply to this topic.