Author Topic: "selectedRow":false in datamodel  (Read 3502 times)

Shital

  • Newbie
  • *
  • Posts: 2
    • View Profile
"selectedRow":false in datamodel
« on: December 19, 2014, 03:39:25 pm »
Hi ,

After editing data in Grid, if I read data I get "selectedRow":false  in data.
I am reading data with following code


Code: [Select]
var DM = $("#leftTopGrid").pqGrid("option", "dataModel");
                var griddata = DM.data;
                alert('grid data...' + JSON.stringify(griddata));


And I get the result as


grid data...[{"Line":"Line1","Col1":"Acc ","Col2":" {0008,0050} ","Col3":" {0008,1030}","Col4":"","Col5":"true","selectedRow":false},{"Line":"Line2","Col1":"{0008,1030} ","Col2":"abc","Col3":"test34","Col4":"","Col5":"","selectedRow":true},{"Line":"Line3","Col1":"imo","Col2":" {0020,0013} ","Col3":"shital","Col4":"","selectedRow":false}]


Thanks,
Shital

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: "selectedRow":false in datamodel
« Reply #1 on: December 19, 2014, 04:09:25 pm »
It's expected as grid stores the state of selections within the rows.

Shital

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: "selectedRow":false in datamodel
« Reply #2 on: December 19, 2014, 04:23:10 pm »
But I want send that data back to server to save in json file. how should I remoeve these state values?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: "selectedRow":false in datamodel
« Reply #3 on: December 19, 2014, 04:34:39 pm »
You could iterate over the rows and delete selectedRow property

for loop
var rowData = data[ i ];
if (rowData[ 'selectedRow' ] !== undefined ){
  delete rowData[ 'selectedRow' ];
}