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

Referencing all DDLs by class

1 Answer 25 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Heather
Top achievements
Rank 1
Heather asked on 08 Oct 2012, 12:15 AM
We can create DropDownLists by class:
        $(".theClassName").kendoDropDownList({});

And we can reference them by id to apply methods:

     var list = $("#theID").data("kendoDropDownList");
    list.select(0);
    list.refresh();

But it doesn't seem we can reference all lists by classname:

    var allLists = $(".theClassName").data("kendoDropDownList");

allLists is undefined.  Is there a way to apply a method to all dropdownlists of the same class?

1 Answer, 1 is accepted

Sort by
0
Heather
Top achievements
Rank 1
answered on 08 Oct 2012, 01:50 AM
SOLVED:

Declared all DDLs with the handle allAttributes
        var allAttributes = $(".attribute").kendoDropDownList({

Referenced them to select index as such:
        $.each(allAttributes, function () { $(this).getKendoDropDownList().select(0); });

Not sure if there is an easier way, but it works.
Tags
DropDownList
Asked by
Heather
Top achievements
Rank 1
Answers by
Heather
Top achievements
Rank 1
Share this question
or