Prevent default tab event in input of cell in edit mode (Kendo Grid) also prevent update the data has just input?

1 Answer 541 Views
Grid
Phuong
Top achievements
Rank 1
Phuong asked on 22 Sep 2021, 10:04 AM

I have a grid use Kendo Grid. When i custom edit event and add event to input in edit mode like this

edit: function (e) {
                        if (e.container[0]) {
                            var cell = e.container[0]
                            $rootScope.rowToFocus = angular.element(cell).closest('tr').index();
                            $rootScope.colToFocus = e.sender.cellIndex(angular.element(cell).closest('td'));
                            if ($rootScope.rowToFocus != 0 || $rootScope.colToFocus != 0) {
                                $rootScope.gridToFocus = e.sender;
                                e.container.find("input").on("keydown", function (ev) {
                                    if (ev.which == 9 || ev.which == 13) {
                                        $rootScope.isKeyboard = true;

                                        ev.preventDefault();

                                     }  
                                })
                            }
                            else {
                                $rootScope.rowToFocus = undefined;
                                $rootScope.colToFocus = undefined;
                            }
                        }
                    }, 

So i prevented default of tab event but aslo prevent update the data i input in this... Please help me a solution to prevent tab event in my input and still raise the update data event when i leave this cell.

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 27 Sep 2021, 07:51 AM

Hi, Phuong,

Thank you for the provided code snippet.

You could handle the cellClose event which is fired once a grid cell is closed and then call the saveRow() method to save any pending changes.

              	cellClose: function(e) {
                  let grid = this;
                  grid.saveRow();
                }

Let me know if you have any questions.

Best Regards,
Georgi Denchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Phuong
Top achievements
Rank 1
commented on 28 Sep 2021, 06:23 AM

Sr i did that but seem not useful. I think because i use offline datasource in grid. The grid i use to input the detail data. In front of grid has 1 form to input master data. So user have input all data after that click the Save button to save all data.
Phuong
Top achievements
Rank 1
commented on 28 Sep 2021, 06:31 AM

The reason that i must prevent tab event of input because i custom a tab or enter to move next cell (not use navigate: true because i must custom the order of cell). Almost required done, but have a problem with cursor focus to next input (tab default) before move to the next cell. its make a little bit inconvenience for user in interfaces
Georgi Denchev
Telerik team
commented on 01 Oct 2021, 07:13 AM

Hi, Phuong,

Given that the problem is related to a custom solution and not the officially supported "navigate" functionality, I am afraid that I cannot help much more.

I might be able to give you some advice if you could provide me with a runnable sample(in Dojo for example) which I can debug and examine.

Tags
Grid
Asked by
Phuong
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or