I faced a critical problem with jqGrid today. Let’s explain my problem first.
I have a main grid which contains the following columns:
Scholarship Name .................................. Student Type
-----------------------------------------------------------------
Full Free Studentship ............................. Poor
Sir Alfred Nobel Scholarship ...................... Meritorious
Taj Uddin Memorial Scholarship .................... Individual
Now I need a sub-grid of this main grid. Student Type is a select type column. When user choose Poor for the Student Type column and click on sub-grid icon then the following sub-grid will be shown:
Guardian Income Range Start Value ....................... Range End Value
--------------------------------------------------------------------------
0 ....................................................... 5000
5001 .................................................... 10000
When user choose Meritorious then a different sub-grid will be shown which is as follows:
Merit Start .................. Merit End
----------------------------------------
1 ............................ 7
And Individual shows the following:
Student ID
----------
115588
225577
336699
My Question:
Is it possible in jqGrid or any other simple way to implement this.
Thanks in advance.
I’ve found that if you use SubGridRowExpanded and subGridRowColapsed to build the subgrid that you can generate completely different subgrids based upon the row that was expanded.
Below I’ve included a modification of the GridAsSubGrid example at JQGrid Here it simply looks at the ID of the row being expanded, and if its a special case (id=12345) it displays a special grid. You could filter yours based on the student type and show a grid accordingly.
I am using addRowData to add the information, I haven’t tested other data binding methods.