jQWidgets Forums
jQuery UI Widgets › Forums › Grid › accessing parents row Id from a toolbar
Tagged: grid, jqxgrid, json, nested grids, rendertoolbar, rowexpand, rowid, toolbar
This topic contains 6 replies, has 2 voices, and was last updated by Dimitar 10 years, 9 months ago.
-
Author
-
Hi everyone, i have created a grid which creates a subgrid on a $(‘#grid’).on(‘rowexpand’, function (event){} when this event is triggered it creates the subgrid with a tool bar. to this tool bar it passes the row index to an onlick function where i want to modify what ever is within the subgrid. my problem seems to be that if i have multiple subgrids open at a time and i click the toolbars onclick function, i just get the latest row expanded Id.
is there anyway that i can get the parents row id from the tool bar itself?
this is my tool bars code
rendertoolbar: function (toolbar) {
var gridTitle = ‘<div style=”width: 100%; text-align:left; margin-left:6px”>’;
gridTitle += ‘‘;
toolbar.append(gridTitle);
roleGridindex is the latest expanded row. i want this variable to correspond to what ever row im currently clicking on. this is how im getting the value for the index
$(‘#adminrole_grid’).on(‘rowexpand’, function (event) {
var Gridindex = $(“#grid”).jqxGrid(‘getrowid’, event.args.rowindex);
}
Hello kev1989,
You can see the recommended way of creating nested grids in the following demo: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/nestedgrids.htm?arctic.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar, my grids work as the demo you showed. any chance you can show me the sample code for the demo? i do understand i might have implemented my grid and subgrids wrong making my goal more difficult to obtain then it would be if i followed the correct implementation. just wanted to clirify with you to make sure that it infact is possible for me to do. i have a grid that on row expand shows more data coming as JSON from a database with respect to one of the field values of that row in a subgrid. after that i need to be able to delete a row from that subgrid and also add a row with information to that rows subgrid.
thanks in advance.
Hi kev1989,
You can right click and choose View page source in Google Chrome (there are similar options for the other browsers) to view the code of the demo. The example is also included in the jQWidgets download package, in
demos\jqxgrid
.Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you very much, i was going into inspect element…..
i now have 4 hours to completely change my implementation….
Sorry to bother you again guys, ive been looking through all the demos but i cant seem to find a working demo in which it pulls data from a database in JSON format and has nested grids. i see the Demo is using XML with nested grids but then theres a JSON demo that populates a single grid. if you can point me to the demo i am looking for that would be much appreciated now that i cant seem to put these two together on my own. i have no clue what i am doing with these two types of data.
again a working demo that uses JSON as a datatype with nested grids. thank you
Hi kev1989,
There is such an example in the jQWidgets download package, in
phpdemos\server_side_grid__with_nested_grids
. We hope it is helpful to you.Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.