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

What ID should I choose for my custom editor?

1 Answer 18 Views
Editor
This is a migrated thread and some comments may be shown as answers.
NHJ
Top achievements
Rank 1
NHJ asked on 31 Dec 2019, 11:27 AM

Hello,

I often use custom editors.

But when using the dropdown list
$ ("# ..."). data ('kendoDropDownList');

I need to access the editor in the form, but I don't know what goes into # ...

If you created this editor statically, you would have an ID, but if you create a custom one, you will not have a separate ID.

My custom editor looks like this, and the ID I tried was the same as the string output in options.field.

dayDropDownEditor : function (container, options) {
    $('<input id="operDay"  data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            suggest: true,
            dataSource: [
                {name:'월', operDay: '월요일', isDeleted: true },
                {name:'화', operDay: '화요일', isDeleted: false },
                {name:'수', operDay: '수요일', isDeleted: true },
                {name:'목', operDay: '목요일', isDeleted: false },
                {name:'금', operDay: '금요일', isDeleted: false },
                {name:'토', operDay: '토요일', isDeleted: false },
                {name:'일', operDay: '일요일', isDeleted: false }
            ],
            dataTextField: 'operDay',
            dataValueField: 'operDay',
            valuePrimitive: true,
            select: function(e){
                alert(JSON.stringify(options.field));
                 
            },
            change: function(e) {
 
            },
            template: kendo.template($("#template").html())
        });
}

 

"fn1": function() {
                var dropdown = $("#operDay").data("kendoDropDownList");
                var oranges = dropdown.dataSource.get(2);
                oranges.set("isDeleted", true);
            }

What data should be inside # ... for me to access .data ('kendoDropDownList')?

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 01 Jan 2020, 10:55 AM

Hi,

The $ ("# ...") is just a jQuery selector if by any chance it is not suitable for your scenario you could use any other way to find your DropDownList input on the page - for example to find the input of the first DropDownList on the page you could use this selector - $(".k-dropdown").first().find("input") .

Regards,
Plamen
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Editor
Asked by
NHJ
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or