0

I am having a weird issue and I haven't a clue in how to fix this.

Let's say I have a grid which is build on the server side - yes, we've a class DynamicGrid (PHP) receiving a few parameters and building all the HTML/JS needed by jQgrid to render a grid.

We're also storing the grid setup in a MongoDB as for example: columns sort (horizontal & vertical) and some other custom stuff.

When the grid loads for first time the data is displayed properly. This is how the code looks like after being generated (example on Gists since it's a big one).

enter image description here

Here is a JSON data passed to the grid.

I can even sort the columns and it still working (column AgreementId has been reordered):

enter image description here

Each time I paginate the grid I check for the stored settings looking for any change (in fact it's returning all the time what's stored so no checking on differences at all) the proper order on the colNames and colModel.

I can say (and can leave an example if needed) the colNames and colModel are coming as sorted previously. The JSON data is coming properly ordered as well.

For some reason the grid is misaligned and the values won't display properly anymore.

enter image description here

Check in the image above how the AgreementId and the Quote Status are misaligned as what I have on the 2nd image.

Here is the data returned on the pagination. The order looks fine to me so there is nothing wrong on the backend part seems to be a Javascript + DOM issue or I don't know because this is killing me.

Can any give me some ideas in how to deal with this or fix it at all? The version of jQgrid used is free-jqGrid 4.14.1.

UPDATE: I think the problem could be maybe on the column "Actions" how do I fix this column to be the first one all the time and do not allow to sort it?

I have managed to move the values for the column Actions at the beginning of my JSON data but that doesn't fix the issue.

For some reason as soon as I move forward/backward the model is not being updated properly in the DOM or somewhere and the wrong data is show at the wrong column.

I am currently out of ideas so any help still welcome :)

ReynierPM
  • 17,594
  • 53
  • 193
  • 363
  • 1
    Trying to understand. The data only gets into the wrong cells when you page the grid? Can you show a "working" data return from the server and a "non-working" return? – gforce301 Jun 20 '17 at 16:23
  • @gforce301 I have added more info on the OP also the JSON as you requested ... – ReynierPM Jun 20 '17 at 17:27
  • @gforce301 you mean like [this](https://gist.github.com/reypm/608dc90efeb2cec190a82d2a7fcbeccb#file-default1-json) ?? somehow I can sort the column no matter what – ReynierPM Jun 20 '17 at 18:03
  • My mistake. That only disables "sorting" of the data in the coiumn. Read this for an answer of making certain columns unable to be "reordered". [jqGrid - Disable Reordering of Specific Columns](https://stackoverflow.com/questions/12607931/jqgrid-disable-reordering-of-specific-columns) – gforce301 Jun 20 '17 at 19:22
  • This post [JQGrid with Column Reordering](https://stackoverflow.com/questions/2317199/jqgrid-with-column-reordering) gives another method of stopping a column from being reordered. – gforce301 Jun 20 '17 at 19:25
  • @gforce301 thx but that's not the issue currently I've tried to explain it as best as I could – ReynierPM Jun 20 '17 at 20:03

0 Answers0