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

How to modify custom editor data before save?

5 Answers 303 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 15 Apr 2014, 10:46 AM
I have a grid with columns `start` and `end`. I have a template for the start column that shows the two integers concatenated as a range. E.g., "1 - 2". I put a custom editor on this templated column and want to be able to parse the range and set both start and end. Where should I perform this parsing logic? I tried to do it on the datasource change event but calling .set() on the dataitem ends up re-calling the event.

5 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Apr 2014, 08:05 AM
Hello Ryan,

I am not sure if understand correctly the needed functionality but it should not be necessary to parse the template or manually change the value in the data if you wish to show the inputs for both fields in the same column. You should just include inputs with the editor that are bound to the corresponding items. I created a small jsBin example that demonstrates this scenario. If this is not the functionality that you are looking for then please clarify to what and when should the start and end value be set.
 

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ryan
Top achievements
Rank 1
answered on 17 Apr 2014, 06:48 PM
That's great and will work for me but in my case when I hit tab it doesn't tab to the next input. I don't understand why.  http://trykendoui.telerik.com/IFed/2
0
Ryan
Top achievements
Rank 1
answered on 17 Apr 2014, 07:07 PM
I found that setting navigatable to false will allow me to tab but then the enter key doesn't save the row.
0
Ryan
Top achievements
Rank 1
answered on 22 Apr 2014, 01:37 PM
Can you suggest an approach for the problem with tab?
0
Daniel
Telerik team
answered on 24 Apr 2014, 01:58 PM
Hello again Ryan,

I am afraid that this behavior is not supported by the built-in navigation. The navigation will always move the focus to the next cell when the tab key is pressed. In order to avoid this and save the value on enter I can suggest to disable the navigation and implement the needed logic on enter e.g.
var grid = $("#grid").kendoGrid({
    ...
    navigatable: false
}).data("kendoGrid");
 
grid.table.on("keydown", "input", function (e) {
    if (e.keyCode == 13) {
        $(this).blur();
        grid.closeCell();
    }
});


Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or