ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: Mohamed Lakhdari on August 26, 2018, 07:51:15 pm

Title: Update local data
Post by: Mohamed Lakhdari on August 26, 2018, 07:51:15 pm
Bonjour,

How to update  local data cache  (data Source) ?

sample :

dataSource= [
  {id:125, name: "Francois", age:25 },
  {id:126, name: "Alain", age:26 },
   ...
  ]


colModel : [
        {title : 'ID',   dataType : 'integer',   dataIndx : 'id'},
   {title : 'Name', editable : false, dataIndx : 'name'}
      ],

dataModel : {
   data : dataSource,
   recIndx : "id"
}


my need is to update name and age

$("#grid").pqGrid( "updateRow", {
    rowIndx: 2,
    newRow: { name:"Alain Legrand", age: 30 }
});


Title: Re: Update local data
Post by: paramvir on August 27, 2018, 10:46:33 am
Local data can be updated with updateRow.

you need to add column definition for age in colModel

and either make the name column editable or add checkEditable: false in the call to updateRow method.

https://paramquery.com/pro/api#method-updateRow