jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jqxgrid problem
Tagged: grid rows
This topic contains 7 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 5 months ago.
-
Authorjqxgrid problem Posts
-
hello
i have a table consists of page_code,page_title,page_content,created,modified
when i insert a new record the data is stored in the table correctly
the problem is with jqxgrid it inserts a row and display only the page_title field and it display strange code in the page_code field and keep the created and modified fields empty although the data is inserted correctly in the table and when i refresh the page the grid display the data correctly
may you help me please to get a solution for that
thank you
okasha
Hi okasha,
For adding, removing and updating rows, please take a look at this sample: createremoveupdatedata.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comhello mr peter
is it possible to display the page_code column in the grid after inserting row in the database because it doesnt show the code from the table and instead it displays random number for example 7854 and not the inserted page code
Hi okasha,
Not sure whether I understand you, but you can synchronize jqxGrid with your Database, by calling the Grid’s “updatebounddata” method.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comthank you Mr peter
this solved the problem but i think it is not a good solution for the problem due to performance
suppose i have users table with user_code(primary and auto increment),first_name,last_name and i display the three fields in the grid so when i add a new row i open a popup window with two fields first_name and last_name then i add the row to the database and at the same time it is added to the grid the problem is the user_code is not displayed in the grid and a random number is displayed instead
is there a better solution than call updatebounddata to refresh all the grid
i am sorry for disturbance
thank you
okashaaHi okasha,
In the “addrow” callback of the source object, you can make Ajax call for synchronization with your Server Script. The server script as a result may return the new row’s ID. After calling commit(true) in the Ajax function, use the Grid’s setcellvalue to update the new row’s ID with the ID from the Database.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comthis is a good idea but how to get the index of last inserted row in the grid
$(“#jqxgrid”).jqxGrid(‘setcellvalue’, 0, “firstname”, “New Value”);thank you
Hi okasha,
The Grid has a method called ‘getrows’ which returns an array of all rows displayed in the Grid. As the result is an Array, use the Array’s length property.
var rows = $("#grid").jqxGrid('getrows');var lastRow = rows[rows.length-1];
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.