ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: mshapiro on February 13, 2015, 06:47:34 am

Title: Conflict between checkEditable: false and commit/rollback
Post by: mshapiro 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.
Title: Re: Conflict between checkEditable: false and commit/rollback
Post by: paramvir 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
Title: Re: Conflict between checkEditable: false and commit/rollback
Post by: mshapiro 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.
Title: Re: Conflict between checkEditable: false and commit/rollback
Post by: paramvir 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.
Title: Re: Conflict between checkEditable: false and commit/rollback
Post by: mshapiro 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 });