Author Topic: Update local data  (Read 2099 times)

Mohamed Lakhdari

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 2
    • View Profile
Update local data
« 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 }
});



paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6178
    • View Profile
Re: Update local data
« Reply #1 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