0

I have been trying to update a cell in jqgrid for five hours , but it doesn't work yet.

I used:

  var StatusValue = $("#DocumentGrid").getCell(rows[i], "StatusLabel");
  if (StatusValue.toString() == "Affected")
              {
               StatusValue = "Attribué";

               alert(StatusValue);

               $("#DocumentGrid").jqGrid('setCell', 5, 'StatusLabel', 'Attribué');


               $("#DocumentGrid").jqGrid('getLocalRow', 5).DocumentGrid = 'Attribué';
               }

but it didn't work

I tried also this code http://decoder-log.blogspot.com/2013/03/change-cell-value-in-jqgrid.html and How to update value of data in jqgrid but none of them worked.

enter code here
Timotheus0106
  • 1,536
  • 3
  • 18
  • 28
Marwa Kesraoui
  • 21
  • 2
  • 11
  • What is `5` which you use as rowid of `setCell` and `getLocalRow`? You get the data using `rows[i]`, but update it for rowid=5. It's suspected. What you want to do with the code? **When** you need to replace the data? Do you need to make the replacement directly after *loading the data* in the grid? You tried to use `getLocalRow` which work only in case of `datatype: "local"`. Which `datatype` you use? `getLocalRow` is very effective to update *internal data* but the data will be displayed only after *reloading of the grid. So more details required about what you do. – Oleg Feb 12 '15 at 13:32

1 Answers1

0

I solved the issue this way

jQuery("#DocumentGrid").setCell(rows[i], 'StatusLabel', StatusValue);
Marwa Kesraoui
  • 21
  • 2
  • 11