Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
jqGrid Subgrid error with Date field as KEY Parameter + asp.net mvc3
19/03/2014
00:10
Avatar
msbyuva
Member
Members
Forum Posts: 6
Member Since:
23/08/2013
sp_UserOfflineSmall Offline

I am using jQGrid with Subgrid feature, My Key column has Date, when I click on "+" subGridRowExpanded is fired and it creates a SubGrid

Code works fine when used other column which has Number as Key Field but it's throwing error when using Date as key field ex it will have the value 03/18/2014

"Microsoft JScript runtime error: Syntax error, unrecognized expression: #grid_3/18/2014" My main grid id is grid

It works fine when I use GMMNumber as Key but fails when I use NCChitDate which is a Date Field with value in Date Format..

Here is my code below :

function LoadNCTRequestGrid() { var cols = ""; var colmodels = ""; if (!ReqType) { cols = ['Date', 'NC Chit Print', '2nd Scan Disposition', '%', "Items Merch'd in Place", 'Items On Request', 'Carton Completed', '%', 'Open Balance (Items On Request Carton Complete)']; colmodels = [{ name: 'NCChitDate', index: 'NCChitDate', width: 300, key: true }, { name: 'NCChitPrintQty', index: 'NCChitPrintQty', width: 300 }, { name: 'SecondScanDisp', index: 'SecondScanDisp', width: 300 }, { name: 'PercentageSecondScanDisp', index: 'PercentageSecondScanDisp', width: 180 }, { name: 'ItemsMerchandised', index: 'ItemsMerchandised', width: 280 }, { name: 'ItemsOnRequest', index: 'ItemsOnRequest', width: 280 }, { name: 'CartonCompleted', index: 'CartonCompleted', width: 280 }, { name: 'PercentageCartonCompleted', index: 'PercentageCartonCompleted', width: 280 }, { name: 'OpenBalance', index: 'OpenBalance', width: 280 } ]; } else{ cols = ['','GMM', 'NC Chit Print', '2nd Scan Disposition', '%', "Items Merch'd in Place", 'Items On Request', 'Carton Completed', '%', 'Open Balance (Items On Request Carton Complete)']; colmodels = [ { name: 'GMMNumber', index: 'GMMNumber', width: 300, key:true, hidden:true}, { name: 'GMMDesc', index: 'GMMDesc', width: 300 }, { name: 'NCChitPrintQty', index: 'NCChitPrintQty', width: 300 }, { name: 'SecondScanDisp', index: 'SecondScanDisp', width: 300 }, { name: 'PercentageSecondScanDisp', index: 'PercentageSecondScanDisp', width: 180 }, { name: 'ItemsMerchandised', index: 'ItemsMerchandised', width: 280 }, { name: 'ItemsOnRequest', index: 'ItemsOnRequest', width: 280 }, { name: 'CartonCompleted', index: 'CartonCompleted', width: 280 }, { name: 'PercentageCartonCompleted', index: 'PercentageCartonCompleted', width: 280 }, { name: 'OpenBalance', index: 'OpenBalance', width: 280 } ]; } $("#grid").jqGrid({ url: '@Url.Action("GetNCTRequest")', mtype: "POST", datatype: 'json', colNames: cols, colModel: colmodels, width: 1140, height: '100%', rowNum: 5000, subGrid: true, afterInsertRow: function (rowId, aData, rowelem) { var theGrid = $(this); }, beforeSelectRow: function (rowid, e) { return false; }, loadComplete: function () { $("tr.jqgrow:odd").css("background", "#DDDDDC"); $(".jqgrow:odd").hover( function () { $(this).css("background-color", "#E11A2B"); }, function (event) { $(this).css("background-color", "#DDDDDC"); } ); }, subGridRowExpanded: function (subgridDivId, rowId) { var subgridTableId = subgridDivId + '_t'; $("#" + subgridDivId).html("<table id='" + subgridTableId + "'></table>"); var cols = ""; var colmodels = ""; if(!ReqType){ cols = ['GMM', 'DIV', 'Dept', 'Vend', 'UPC', 'NC Chit Print', '2nd Scan Disposition', "Items Merch'd in Place", 'Items On Request', 'Carton Completed', 'Open Balance (Items On Request Carton Complete)', 'Carton ID']; colmodels = [ { name: 'GMMDesc', index: 'GMMDesc', width: 300 }, { name: 'DivisionDesc', index: 'DivisionDesc', width: 300 }, { name: 'DepartmentName', index: 'DepartmentNumber', width: 300 }, { name: 'VendorID', index: 'VendorID', width: 100 }, { name: 'UPCNumber', index: 'UPCNumber', width: 100 }, { name: 'NCChitPrintQty', index: 'NCChitPrintQty', width: 300 }, { name: 'SecondScanDisp', index: 'SecondScanDisp', width: 300 }, { name: 'ItemsMerchandised', index: 'ItemsMerchandised', width: 280 }, { name: 'ItemsOnRequest', index: 'ItemsOnRequest', width: 280 }, { name: 'CartonCompleted', index: 'CartonCompleted', width: 280 }, { name: 'OpenBalance', index: 'OpenBalance', width: 280 }, { name: 'CartonID', index: 'CartonID', width: 100 }, { name: 'NCChitDate', index: 'NCChitDate', width: 10, key: true, hidden : true } ] } else{ cols = ['Date', 'DIV', 'Dept', 'Vend', 'UPC', 'NC Chit Print', '2nd Scan Disposition', "Items Merch'd in Place", 'Items On Request', 'Carton Completed', 'Open Balance (Items On Request Carton Complete)', 'Carton ID']; colmodels = [ { name: 'NCChitDate', index: 'NCChitDate', width: 100}, { name: 'DivisionDesc', index: 'DivisionDesc', width: 150 }, { name: 'DepartmentName', index: 'DepartmentNumber', width: 200 }, { name: 'VendorID', index: 'VendorID', width: 50 }, { name: 'UPCNumber', index: 'UPCNumber', width: 100 }, { name: 'NCChitPrintQty', index: 'NCChitPrintQty', width: 50 }, { name: 'SecondScanDisp', index: 'SecondScanDisp', width: 50 }, { name: 'ItemsMerchandised', index: 'ItemsMerchandised', width: 50 }, { name: 'ItemsOnRequest', index: 'ItemsOnRequest', width: 100 }, { name: 'CartonCompleted', index: 'CartonCompleted', width: 50 }, { name: 'OpenBalance', index: 'OpenBalance', width: 50 }, { name: 'CartonID', index: 'CartonID', width: 100 } ] } $("#" + jQuery.jgrid.jqID(subgridTableId)).jqGrid({ mtype: "POST", datatype: 'json', url: encodeURI('@Url.Action("GetnctRequestIndividualDetails")' + '?reqValue=' + rowId), colNames: cols, colModel: colmodels, rowNum: 9999, height: '100%' }); $(".ui-icon-carat-1-sw").css("background-image", "none"); } }); }

25/03/2014
12:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

You build a grid with date field. Data field has separator "/" as per your definition. This is not allowed for the ids.

Maybe you will need to remove the "/" before building the subgrid and pass a correct string as id.

Regards

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
59 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information