Forum
09:48
19/07/2013
Hello!
I've registered here because I have a little problem.
I want to build my jqGrid dynamically. All values ​​come from the SQL DB. The table is set up correctly, just does not the paging, sorting and filtering. When I enter my colmodel directly in the script, then everything works. So the string looks in the database for each field:
ID colModel (column in DB, text)
—————————
1 name: 'ID', index: 'ID', width: 60, sorttype: 'int'
2 name: 'Title', index: 'Title', width: 90, align: 'right', search: true, searchoptions: { sopt: ['cn']}
…
And here is a part of the script on the client side:
function loadGrid() {
$.ajax({
type: "POST",
url: siteName + "/_vti_bin/IntranetWCFcustomService/myWCFservice.svc/getSettingForJqGrid?serverName=" + serverName + "&dbName=" + dbName + "&tableName=" + $("#tableName").val() + "&viewsID=" + $("#viewsID").val() + "&formID=" + $("#formID").val(),
dataType: "json",
success: function (response) {
var gridName = response[0]["Titel"];
var cnames = response[0]["ColNames"];
var cmodel = response[0]["ColModels"];
var rowNum = response[0]["RowNum"];
jQuery("#list_inventory").jqGrid({
url: siteName + "/_vti_bin/IntranetWCFcustomService/myWCFservice.svc/getSqlData?serverName=" + serverName + "&dbName=" + dbName + "&tableName=" + $("#tableName").val() + "&viewsID=" + $("#viewsID").val() + "&formID=" + $("#formID").val(),
datatype: "json",
height: $("#<%=_ClientID.Text %>_heightValue").val(),
autowidth: true,
rowNum: rowNum,
rowList: [10, 20, 30],
colNames: cnames,
colModel: cmodel,
pager: "#plist_inventory",
viewrecords: true,
sortname: 'ID',
sortorder: 'ASC',
onSelectRow: function (ID) { getDetails(ID); },
caption: gridName,
toolbar: [true, "top"]
}).navGrid('#plist_inventory', { edit: false, add: false, del: false, search: false });
jQuery("#list_inventory").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false });
},
error: function (response) {
alert(response.responseText);
}
});
return false;
}
Where can the problem be then? If I would have my ColModel string in the wrong format, I would get an error message that COLNAMES and CoModel have different lengths. I do not get this message.
I'm sorry for my English!
Sincerely yours
wolfgang
Most Users Ever Online: 715
Currently Online:
27 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