By reading the plugin source code, the struts2-jquery plugin is using the subGridRowExpanded event to build the subgrid. However, since the event is already used by the plugin so I am not possible to use the same event to retrieve the parent row id. So I would suggest the plugin to add the parent row id directly (may be with name pid?) to the editData option of both row edit and row add options when setting up the subgrid using subGridRowExpanded. And of course editData should extends setting in navigatorEditOptions and navigatorAddOptions as well.
Which struts2-jquery plugin version? 3.0.2
Comment #1
Posted on Jun 24, 2011 by Grumpy RabbitThis is what I have done to achieve this so far to make my life easier.
added the lines in jquery.grid.struts2-3.0.1.js
line 400: so.navigatoraddoptions = $.extend(true,so.navigatoraddoptions||{}, {editData:{pid:row_id}}); so.navigatoreditoptions = $.extend(true,so.navigatoreditoptions||{}, {editData:{pid:row_id}});
Comment #2
Posted on Jun 26, 2011 by Grumpy MonkeyTo add a row in subgrid this fix work (I see "pid" in POST array). Thanks! But I use inline edit in subgrid and after save changes "pid" is not send in Ajax request.
Comment #3
Posted on Jun 27, 2011 by Swift LionWhat do you think about an new Topic called onSubGridRowExpanded?
Comment #4
Posted on Jun 28, 2011 by Grumpy RabbitIf we can use it to add the parent row id by setting the editData within it.
Comment #5
Posted on Jul 25, 2011 by Swift LionIssue 602 has been merged into this issue.
Comment #6
Posted on Jul 25, 2011 by Swift LionI added your soultion but rename the paramter to rowid.
so.navigatoraddoptions = $.extend(true,so.navigatoraddoptions||{}, {editData:{rowid:row_id}}); so.navigatoreditoptions = $.extend(true,so.navigatoreditoptions||{}, {editData:{rowid:row_id}});
Also there is now a new Topic onSubGridRowExpanded available. If you like to overwrite the default action you can set event.originalEvent.orginal.proceed = false inside of your topic.
Feedback is welcome.
http://code.google.com/p/struts2-jquery/source/detail?r=1499
Comment #7
Posted on Jul 25, 2011 by Grumpy MonkeyI have testing new version 3.1.1 but no "rowid" parameter is send in POST array. In old version of jquery.grid.struts2-3.0.1.js in line 400 I have receive "pid".
Comment #8
Posted on Jul 26, 2011 by Swift LionI think rowid explain the parameter better than pid.
Comment #9
Posted on Jul 26, 2011 by Massive Giraffethe problem is not in the name of parameter "rowid" is ok. But the idea is to send this parameter after edit or add record in subgrid. And this is not happend now :)
Comment #10
Posted on Jul 26, 2011 by Massive Giraffebut with onSubGridRowExpanded its possible to add "rowid" in editurl link as GET parameter. I think about if is a good idea to send automatically in POST array "id" and "rowid" in subgrid add/edit forms.
Comment #11
Posted on Aug 3, 2011 by Grumpy Rabbit@johgep
Sorry I am not familiar with the subscribe plugin. Can you show me with code on how to add the parent id through handler of onSubGridRowExpanded topic? Also if it's possible to modify the original subgrid options through this?
Comment #12
Posted on Aug 11, 2011 by Swift LionThe Problem why "rowid" was not submited is an problem with the jqGrid form plugin.
https://github.com/tmck2/jqGrid/commit/ad8e68c606327048a7421b6da0209e1c09469f62
This should now be fixed. If you try it, please be sure you have cleared your browser cache.
http://code.google.com/p/struts2-jquery/source/detail?r=1507
Comment #13
Posted on Aug 11, 2011 by Swift Lion(No comment was entered for this change.)
Comment #14
Posted on Aug 13, 2011 by Happy Hippojohgep,thank you very much for your bugfix.
Now I add below statement into the java of editurl of subgrid. rowid works as parent key.
private String rowid;
....
public void setRowid(String rowid) {
this.rowid = rowid;
}
public String getRowid(){
return rowid;
}
Thanks again.
Comment #15
Posted on Aug 26, 2011 by Quick Pandagood bugfix but why did you do it only for add and edit and not for the delete option.
I think its important to have this for the delete option to !!!
so.navigatordeleteoptions = $.extend(true,so.navigatordeleteoptions||{}, {editData:{pid:row_id}});
Comment #16
Posted on Aug 31, 2011 by Quick Pandaafter test of such a delete patch it should be (add on ligne 415 / jquery.grid.struts2-3.1.1.js)
so.navigatordeleteoptions = $.extend(true,so.navigatordeleteoptions||{}, {delData:{rowid:row_id}});
Comment #17
Posted on Oct 15, 2012 by Happy WombatHello
When I use inline edit (add or edit) in subgrid and click save button, don't execute setRowid method in my editurl subgrid action. ¿How can i do?
Thanks
Status: Fixed
Labels:
Type-Defect
Priority-Medium
Component-Grid-Plugin
Milestone-3.1.1