Author Topic: Save columns state when column grouping is enable  (Read 2110 times)

KR

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 8
    • View Profile
Save columns state when column grouping is enable
« on: August 18, 2016, 01:44:06 pm »
Hi!

The following code is not working with a colmodel if column grouping enabled:

var colModel = $gridMain.pqGrid("option", "colModel");
var strCM = JSON.stringify(colModel);

Gives an «cyclic object value»-error.

Is there an other way to save/serialize to colmodel?

The code works perfectly with simple colmodels.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Save columns state when column grouping is enable
« Reply #1 on: August 19, 2016, 09:44:35 am »
This is due to the parent property of nested columns.

Please use this:

Code: [Select]
var strCM = JSON.stringify(colModel, function(key, val){
if (val && val.parent) {
val.parent = undefined;
}
return val;
});