Forum


01:32

16/06/2011

Hi I am trying to use the great subrid feature with my jqgrid. However, I am having trouble with getting it to display.
Here is my javascript:
$(document).ready(function(){
jQuery('#list').jqGrid({
jsonReader:{
root: "DATA",
page: "CURPAGE",
total: "TOTALPAGES",
records: "TOTALPAGES",
repeatitems: false,
id: "rowid",
subgrid: {root:"rows", repeatitems: true, cell: "cell", id:"id"}
},
url: 'get_applicants.cfc?method=get_applicants',
datatype: 'json',
width: "auto",
height: "auto",
mtype: "GET",
colNames: ['Student ID','Last Name','First Name', 'County', 'Last School Attended', 'Last School County',
'Major', 'GPA', 'UC Regents Scholar', 'Citizenship', 'Undergarduate', 'Enrolled', 'Unmet Need',
'FAFSA', 'Submit Date', 'Save Date', 'ISMCAR', 'ISFLYD', 'ISANT','ISCOAT', 'ISKOER', 'ISSHOB', 'ISSPCK', 'ISPTR',
'ISWB', 'ISBEN2', 'ISUCM', 'ISKRUS','ISCAF', 'ISREN'],
colModel: [
{name:'studentid',index:'studentid', width:100, sortable:true, key:true},
{name:'last',index:'last', width:200, sortable:true},
{name:'first',index:'first',width:200, sortable:true},
{name:'county',index:'county',width:200, sortable:true},
{name:'school',index:'school', width:200, sortable:true},
{name:'schoolcounty',index:'schoolcounty',width:200, sortable:true},
{name:'major',index:'major',width:100, sortable:true},
{name:'gpa',index:'gpa',width:100, sortable:true},
{name:'regents',index:'regents',width:100, sortable:true},
{name:'citizenship',index:'citizenship',width:100,sortable:true},
{name:'undergrad',index:'undergrad',width:100, sortable:true},
{name:'enrolled',index:'enrolled',width:100, sortable:true},
{name:'need',index:'need',width:100, sortable:true},
{name:'fafsa',index:'fafsa',width:100, sortable:true},
{name:'savedate',index:'savedate',width:150,sortable: false},
{name:'submitdate',index:'submit',width:150, sortable:true},
{name:'ismcar',index:'ismcar',width:100},
{name:'isflyd',index:'isflyd',width:100},
{name:'isant',index:'isant',width:100},
{name:'iscoat',index:'iscoat',width:100},
{name:'iskoer',index:'iskoer',width:100},
{name:'isshob',index:'isshob',width:100},
{name:'isspck',index:'isspck',width:100},
{name:'isptr',index:'isptr',width:100},
{name:'iswb',index:'iswb',width:100},
{name:'isben',index:'isben',width:100},
{name:'isucm',index:'isucm',width:100},
{name:'iskrus',index:'iskrus',width:100},
{name:'iscaf',index:'iscaf',width:100},
{name:'isren',index:'isren',width:100}
],
rownum: 10,
rowList:[10,20,30],
pager: '#pager',
sortorder: "asc",
viewrecords: true,
loadonce: false,
caption: "List of Applicants",
gridview: false,
subGrid:true,
subGridUrl: "get_applicants.cfc?method=get_scholarships",
subGridModel:[{
name: ['StudentID', "Test"],
width: [100, 100],
params:['studentid']}]
}).navGrid('#pager', {search:true, edit:false, add:false, del:false})
});
And here is the cfc method that the subgrid is calling:
<cffunction name="get_scholarships" access="remote" returntype="json" output="false" securejson="false">
<cfargument name="studentid" required="no" default="0″ />
<cfargument name="page" required="no" default="1″ />
<cfargument name="rows" type="numeric" default="10″>
<cfargument name="sidx" type="string" default="">
<cfargument name="sord" type="string" default="ASC">
<cfargument name="nd" required="no" default="0″>
<cfset var arrCases = ArrayNew(1)>
<cfquery name="get_sub_students" datasource=#Application.FACSSA#>
select Student_ID "studentid" from FA_CSSA_Students
where Student_ID = '#arguments.studentid#'
</cfquery>
<cfset start = ((arguments.page-1)*arguments.rows)+1>
<cfset end = (start-1) + arguments.rows>
<cfset i = 1>
<cfloop query="get_sub_students" startrow="#start#" endrow="#end#">
<cfset arrCases[i] = [#get_sub_students.studentid#]>
<cfset i = i + 1>
</cfloop>
<cfset totalPages = ceiling(get_sub_students.recordcount/arguments.rows)>
<cfset stcSubCases = {total=#totalPages#,page=#arguments.page#,records=#get_sub_students.recordcount#,rows = arrCases}>
<cfreturn stcSubCases>
</cffunction>
Using Firebug I get the following error:
Detail: | If the component name is specified as a return type, its possible that a definition file for the component cannot be found or is not accessible. |
Message: |
The value returned from the get_scholarships function is not of type json. |
Most Users Ever Online: 715
Currently Online:
81 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