0

I have a requirement to set select a row when the grid is loading ,based on the data value of a column in a particular row. ( In my case select the row with invoice number IVAXVL18066996 / refer the attachment ).

enter image description here

I am researching solution for awhile and still can not find favorable answer. I ll really appreciate if someone can help here with this matter

Thanks in advance

shanika yrs
  • 303
  • 1
  • 13
  • 1
    Have you tried the answer from here? https://stackoverflow.com/questions/15095433/select-a-row-in-jqgrid-based-on-cell-value – Madalinul Feb 22 '18 at 08:53

1 Answers1

0

with the suggestions of @Madalinul and @Mark I sorted the problem. The fix is as followed

  loadComplete : function(data)
       {
         var rowIds = grid.jqGrid('getDataIDs');

         for (i = 0; i < rowIds.length; i++) {
             invNumberFromGrid = grid.jqGrid ('getCell', rowIds[i], 'invoiceNumber');

             if(invNumberFromGrid === generatedInvoiceNumber){
                 grid.jqGrid('setSelection', rowid, true);
                 break;
             }
         }
       }

All credit goes to them and the community. Many thanks

shanika yrs
  • 303
  • 1
  • 13