Forum
19:19
05/09/2012
Upgrading jqGrid from a build mid-april to latest github snapshot I ran into a small issue and I'm not sure where the problem lies.
Grid Defined as:
      $('#jqgReports').jqGrid({
        //url from wich data should be requested
        url: '@Url.Action("ReportAdminList")',
        //url for inline edit
        editurl: '@Url.Action("ReportAdminEdit")',
        datatype: 'json',
        //url access method type
        mtype: 'POST',
        //columns names
        colNames: ['', 'ID', 'Title', 'List Description', 'Report Header', 'Report Footer', 'Year', 'NAICS', 'Org Code', 'Center', 'Enabled', 'Requires Data', 'Report Category', 'Rpt/App', 'Cover PDF file'],
        //columns model
        colModel: [
              { name: 'showlink', width: '70', formatter: 'showlink', formatoptions: { baseLinkUrl: '@Url.Action("ReportAdminDet", "Report")' }, search: false },
              { name: 'reportid', width: '40', index: 'reportid', align: 'left', editable: false, search: false, key: true},
              { name: 'Title', width: '200', index: 'Title', align: 'left', editable: true, edittype: 'text', editoptions: { maxlength: 40, size: 60 }, editrules: { required: true }, formoptions: { rowpos: 1, colpos: 1 } },
              { name: 'DisplayDesc', index: 'DisplayDesc', hidden: true, width: '250', align: 'left', editable: true, edittype: 'textarea', editrules: { edithidden: true, required: true }, formoptions: { rowpos: 2, colpos: 1 } },
              { name: 'HeaderDesc', index: ' HeaderDesc', hidden: true, editable: true, edittype: 'textarea', editrules: { edithidden: true }, formoptions: { rowpos: 2, colpos: 2 } },
              { name: 'FooterDesc', index: ' FooterDesc', hidden: true, editable: true, edittype: 'textarea', editrules: { edithidden: true }, formoptions: { rowpos: 3, colpos: 1 } },
              { name: 'reportyear', index: 'reportyear', width: '50', align: 'left', editable: true, editoptions: { maxlength: 4 }, edittype: 'text', editrules: { required: true }, search: true, searchoptions: { sopt: ['eq'] },formoptions:{rowpos: 4, colpos: 1} },
Notice the "key:true" property on the 'reportid' column.
With the latest snapshot, the ID that is used by the grid for edit/update/etc is the rowid in the grid, not the value in reportid.
If I remove the "key:true" property, the proper key value passed in from the data source is used (which relates to the reportid field)
I tracked the issue back to this commit:Â https://github.com/tonytomov/jqGrid/commit/bc8601b8dde4fa29e08b4ca08eead10a87e21316
What I'm seeing is the change now requires the data to be passed in with the key specified as the column name now (before my json return string still was passing "id" as the key, but the column has this as "reportid".
This seems to be a limitation to the "Lib.Web.Mvc" plugin I was using to generate the Json response. Â This always sends the key as "id" in the response array. Â Before this was fine as the key seemed to be read in than the model would send back "reportid" as part of the model.
Now it seems the Jsonresult that generates the data has to have the same name as the column specified as the "key:true" field.
Would that be a correct assessment?
16:37
Moderators
30/10/2007
Hello,
Â
Can you please post your json response?
Do you have any changes in jsonReader?
The grid first search for key:true and then for the id from the response.
Â
Kind 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.
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