Author Topic: Change value in ui.rowData not regard as dirty  (Read 4517 times)

lsl

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Change value in ui.rowData not regard as dirty
« on: October 15, 2014, 12:18:28 pm »
There are two columns col1, col2  in a grid

In cellSave event of col1, I have the follow coding
ui.rowData["col2"]=ui.rowData["col1"]*40;
$grid1.pqGrid( "refreshCell", { rowIndx: ui.rowIndx, dataIndx: 'col2' } );

It works fine but cannot be saved in update mode because the col2 is not regard as dirty
1) col1 has a red tag but col2 no red tag.
2) In col2, ui.newVal is the same of ui.oldVal  ie. the ui.oldVal is updated as the same as the new value
3) changes = $grid1.pqGrid("getChanges", { format: "raw" }), changeds.updateList not able to record the change in col2.

Does it have solution?


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Change value in ui.rowData not regard as dirty
« Reply #1 on: October 15, 2014, 12:23:26 pm »
use updateRow to make changes in col2

lsl

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Re: Change value in ui.rowData not regard as dirty
« Reply #2 on: October 15, 2014, 12:55:19 pm »
I have changed as follow,
$grid1.pqGrid( "updateRow", {rowIndx: ui.rowIndx, row: {  'col2': ui.rowData["col1"]*40 }} );
$grid1.pqGrid( "refreshCell", { rowIndx: ui.rowIndx, dataIndx: 'col2' } )

it can mark the col2 as dirty. But there is another problem, the col1 is still in edit mode after tab to col2. So that both col1 and col2 are in edit mode now.

How to solve this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Change value in ui.rowData not regard as dirty
« Reply #3 on: October 15, 2014, 01:24:37 pm »
There is no such known issue.

Please share a jsfiddle:

http://jsfiddle.net/paramquery/467uvjz7/

lsl

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Re: Change value in ui.rowData not regard as dirty
« Reply #4 on: October 15, 2014, 06:08:42 pm »
Oh Yes, It works with version 2.2

I still use the previous two version, I cannot upgrade to the latest one because there are many changes involved.
For example, the changes.updateList is quite different from previous version. Is there any detail document about the difference to different version?

It may help me to upgrade more easily.