pconrey
pconrey

Reputation: 6015

Questions About and Issues With JqGrid

I'm sure my questions have been addressed somewhere, but I've researched for a while now and can't seem to find the answers I'm looking for.

  $("#attributeEditList").jqGrid( { 
            datatype: "local",
            height: 150,
            colNames: ['rowid', 'Vendor', 'Category', 'Key', 'Value', 'Flags', 'Status'], 
            colModel: [
                        {name: 'rowid', index: 'rowid', hidden: true, key: true},
                        {name: 'vendorCode', index: 'vendorCode', hidden: true},
                        {name: 'category', index: 'category', width: 120, editable: true, editrules:{required: true} }, 
                        {name: 'key', index: 'key', width: 120, editable: true, editrules:{required: true} }, 
                        {name: 'value', index: 'value', width: 200, editable: true, editrules:{required: true} }, 
                        {name: 'flags', index: 'flags', width: 80, editable: true, editrules:{required: true, integer: true} }, 
                        {name: 'status', index: 'status', hidden: true }
                      ], 
            sortname: "category", 
            viewrecords: true,
            caption: "Attributes",
            rowNum: 20000,
            pager: '#attributeEditPager',
            editurl: "vendor/ajax/dummy.do",
            data: vendor.attributes,
            jsonReader : { repeatitems: false }
          });
          $("#attributeEditList").jqGrid( "navGrid", '#attributeEditPager', {
              edit: false, 
              add: false, 
              del: true,
              search: false,
              refresh: false,
              delfunc: deleteAttribute
            }
          );  
          $("#attributeEditList").jqGrid( "inlineNav", '#attributeEditPager' );  

If you have any advice on these issues, please let me know.

Upvotes: 1

Views: 908

Answers (1)

Oleg
Oleg

Reputation: 222017

Look at the demo from the old answer where I demonstrate how one can implement local form editing in jqGrid. You first question was about the "Delete" added by navGrid. So you can use the trick with setting processing: true which I suggested to make "Delete" button working locally. You should additionally use editurl: 'clientArray'. I posted my suggestion to trirand about one year ago (see here), but the local form editing is still not the part of jqGrid.

You are right that there are many situations in which inlineNav work buggy and if the user clicks on the buttons in a little other order one have wrong activated or wrong deactivated buttons. You have to activate/deactivate the buttons manually using $("#attributeEditList_ilsave").removeClass('ui-state-disabled'); or $("#attributeEditList_ilsave").addClass('ui-state-disabled');. The ids of the buttons will be constructed from the gridid and the postfix "_iladd", "_iledit", "_ilsave", "_ilcancel". I recommend you include such code in the onSelectRow or beforeSelectRow till the bugs will be not fixed in the main code of jqGrid.

Upvotes: 1

Related Questions