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

Instant Grid Editor + more information on cell editors

2 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Guido
Top achievements
Rank 1
Guido asked on 16 Aug 2012, 08:15 PM
A lot of people in my company hate the "click to activate edit mode". For the boolean editor, you have to click to edit it and then click again to switch it.

Replacing the rendering with just a checkbox has weird results. So I've tried to come up with a custom editor:

function instantBoolEditor(container, options) {
    // flip value
    options.model.set('enabled', !options.model.enabled);
 
    // replace html with the same template the column uses
    [...]
     
    // should I do something like trigger change?
    options.model.trigger("change", {container: container, model:options.model}); 
}

Is this the right way to do it and maintain that changes get fired on the datasource change event? Am I messing up data binding?
Is there any more information about custom editors except for the one example here? (http://docs.kendoui.com/api/web/grid) It's very terse info!
That api page mentions these items, but there is no example use that gives any indication what kind of options are "additional options" ??

columns.editor.container Object

The container in which the editor must be added.

columns.editor.options Object

Additional options.

columns.editor.options.field String

The field for the editor.

columns.editor.options.model Object


2 Answers, 1 is accepted

Sort by
0
Guido
Top achievements
Rank 1
answered on 21 Aug 2012, 10:31 PM
Are there ANY kendo people actually reading this forum?

I am now leaning towards this "solution": Adding an edit event listener, checking there for which cells are in edit mode, and then clicking on them ( + clicking on the first cell to lose focus)



edit: function (e) {
                setTimeout(function(){
                    $(".k-edit-cell input:checkbox").click().closest("tr").find("td").click()
                }, 50);
            },
0
Todd
Top achievements
Rank 1
answered on 07 Sep 2012, 03:15 PM
Agreed that the documentation is severely lacking.
Tags
Grid
Asked by
Guido
Top achievements
Rank 1
Answers by
Guido
Top achievements
Rank 1
Todd
Top achievements
Rank 1
Share this question
or