Forum


09:40

04/11/2008

Great job on jqgrid. The more I learn the more I like! I've got my reads and edits working great. Trying to iron our the add controls.
In the parent grid I have a key column "ID_1". It is a FK of the child grid.
I click on the + button and the child grid and all the fields are correctly displayed.
I am using the navGrid Add button.
I've been reading the forums for hours and haven't found an example. I found comments and instructions for accessing a selected row in the parent grid, but since I clicked on the + button, the parent row is NOT selected.
When the ADD form is created I want to insert the value of ID_1 from the parent row.
I don't know how to access the value from the parent grids row.
I don't know how to set this value in the ADD form.
alert('beforeShowForm');
alert(jQuery("#grid1").getGridParam("selrow"));//is null
alert("Key from parent row ID_1 = : " + "???");
form_id.SetValue("ID_1",???);
},
Thanks
01:05

Moderators
30/10/2007

Hello,
I suppose you use grid as subgrid
When you open the subgrid in subGridRowExpanded the
second parameter is the id of the row - then
subGridRowExpanded : function (sub_id, row_id) {
...
$("#mygrid").setSelection(row_id);
...
}
This will select your row.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
08:40

04/11/2008

Tony,
That makes sense!. I was thinking that since the row was not selected in the exampe that there might be a way of getting the row if it was not selected.
For my project, in this case, it is correct to select the row. I suppose that in trees expand and select node are distinct operations often. In a grid it probably the case that select on expand is almost always correct.
Thanks for you help on this!
Barry
07:46

04/11/2008

Tony,
SubGrid as Grid configuration (Master-Detail):
I set the row to selected on expand. When I click add to open the modal add dialog the FK index is correctly set in the Add Form.
Here is a problem. The user can select another row in the master grid. If the user selects another row then the add form dialog wil contain the FK value from the new (currently) selected row.
What the SubGrid needs to know is the ID of the row that caused it to open. Have you considered this? Is there a built in solution?
Thanks!
Barry
01:06

Moderators
30/10/2007

Hello,
Sorry but It is difficult to understand.
What is FK index?
Where is your add button? Where the user click to add - in master
or in detail?
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
07:31

04/11/2008

Tony,
Foreign Key Index - The key that linkes a master - a foreign key is a referential constraint between two tables. Its the key that makes a master-detail relationship.
Add button... both the master table and the detail table has an add button on the bottom of the grid. The problem is with the detail table (sub grid). The sub grid needs to know the FK of the master table . The subgrid needs to know which row is the master. I am currently doing that by setting the selected row and then getting the value from the selected row. That works until the user clicks on another row.
Barry
03:23

Moderators
30/10/2007

Hello,
One possible solution for your problem IMHO is to close all opened
subgrids and and then to open only one for editing and other operation.
Currently you can not do this. I have make some little changes so
that this can be done and will be available in the next release.
The little piece of code that would resolve your problem can look like this:
var minuses = table.find("img[src$=minus.gif]").each(function() {
$(this).parents("td").eq(0).click();
});
You should call this in subgrid row expanded event, but should wait
until the next release.
Regards
Tony
to use
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
65 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66