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?
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top