Author Topic: Conflict between checkEditable: false and commit/rollback  (Read 3460 times)

mshapiro

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 35
    • View Profile
Conflict between checkEditable: false and commit/rollback
« on: February 13, 2015, 06:47:34 am »
I am using isDirty() / commit / rollback as in the row editing demos.  Some cells in each row are not editable.  When I add a new row I need to populate these cells.  If I use checkEditable: false when I add the new row, then I can set the values.  Doing that causes a problem with using commit on the new row.  Is there a way to set the non-editable values and still be able to commit and rollback?  Thanks.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Conflict between checkEditable: false and commit/rollback
« Reply #1 on: February 13, 2015, 04:25:05 pm »
Could you please mention what problem do you face with commit and checkEditable: false.

Addition
======

Please set this option historyModel: { checkEditable: false } and let me know whether it resolves your problem.

http://paramquery.com/pro/api#option-historyModel
« Last Edit: February 15, 2015, 06:31:21 pm by paramquery »

mshapiro

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Conflict between checkEditable: false and commit/rollback
« Reply #2 on: February 18, 2015, 03:42:52 am »
 historyModel: { checkEditable: false } did not resolve the issue.  The problem is with the row that is added if I used addRow with checkEditable: false.  After the update is POSTed to the server and I get the response back, I set the value of the primary key for the new row and then do:
                        grid.commit({ type: type, rows: [rowData] });
                        grid.refreshRow({ rowIndx: rowIndx });

The editable cells still show a red icon in the corner.  If I click Edit to go into edit mode on that row and then click Cancel, the changes are lost and the cells are blank.  No other rows are affected.  Thanks.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Conflict between checkEditable: false and commit/rollback
« Reply #3 on: February 19, 2015, 01:53:07 am »
I'm not able to reproduce the issue mentioned by you.

I edited this demo http://paramquery.com/pro/demos/editing line 35, 36, 207 by setting UnitsInStock { editable: false } and checkEditable: false while adding new row, but it works just fine.

Could you please re check what other changes have you made or you could provide a jsfiddle.
« Last Edit: February 19, 2015, 02:03:29 am by paramquery »

mshapiro

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Conflict between checkEditable: false and commit/rollback
« Reply #4 on: February 19, 2015, 05:43:34 am »
I can't see the problem, but I have a workaround which to do a second commit after the commit for the primary key of the added record.  Then everything works as expected.  Thanks.

                        grid.commit({ type: type, rows: [rowData] });
added:              grid.commit();
                        grid.refreshRow({ rowIndx: rowIndx });