This is a migrated thread and some comments may be shown as answers.

Update and add new row staying in Popup Editor

1 Answer 356 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Juerg
Top achievements
Rank 1
Juerg asked on 20 Sep 2017, 09:33 AM

The user story:  

- I hit the NEW (Insert) Button in the Grid toolbar.  (k-grid-add)

- After inserting the data in the Popup editor, I hit the k-grid-update Button in the Popup editor.

- The Popup editor should stay open with a new record, or at least auto-reopen, so I can go on with entering the next record.

 

Is there a way to have an "insert and add another row" Button to stay in the Popup editor?

I tried all combinations of addRow from the Grid API, but I allways get an Uncaught TypeError

 

kendo.all.js:10682 Uncaught TypeError: Cannot read property 'uid' of undefined

    at init.cancelRow (kendo.all.js:10682)
    at init.editRow (kendo.all.js:10401)
    at init.addRow (kendo.all.js:10876)
    at Object.complete (index:3034)
    at i (jquery.min.js:2)
    at Object.fireWith (jquery.min.js:2)
    at y (jquery.min.js:4)
    at XMLHttpRequest.c (jquery.min.js:4)

 

Thanks for the support.

 

 

1 Answer, 1 is accepted

Sort by
0
Juerg
Top achievements
Rank 1
answered on 21 Sep 2017, 11:51 AM

Got this from support, kind of a hack, but works:

 

==>> The described error is thrown because addRow is called while the grid is still in edit mode. In order to avoid this error is necessary to call addRow when the previous item has been added and the popup is closed. The latest event in the grid is dataBound, so my suggestion is to call addRow when it is fired.


Have in mind that even in the handler of the dataBound event, it is necessary to wrap the logic for reopening the popup in setTimeout method.  (=> That part is not so clean...)

The following dojo illustrates how the aforementioned approach behaves. Note that you may need to adjust the interval in the setTimeout method so it fits your environment:

http://dojo.telerik.com/OdAqu/3

 

 

 

Tags
Grid
Asked by
Juerg
Top achievements
Rank 1
Answers by
Juerg
Top achievements
Rank 1
Share this question
or