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

Title field populated via dropdownlist

2 Answers 193 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 22 Sep 2013, 10:32 AM
As per the title, is it possible to have the title field populated via a DropDown in the popup editor rather than a text field?

I'm using razor to generate the scheduler.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 23 Sep 2013, 09:06 AM
Hello Sean,

You can use the edit event to get reference to the popup editor container and to modify its content. As in this instance to find the title input element and instantiate a KendoUI DropDownList widget. For example:

function edit(e) {   
    //find the title element and create a DropDownList bound to the all event titles
    e.container.find("[name=title]").removeClass("k-input").kendoDropDownList({
      dataTextField: "text",
      dataValueField: "value",
      dataSource: $.map(this.dataSource.data(), function(e) {
        return {
          text: e.title,
          value: e.title
        }
      })
    });
  }

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sean
Top achievements
Rank 1
answered on 23 Sep 2013, 10:46 AM
Thanks, very useful. I use a controller method to return the data, below is the code used for completion.

function edit(e) {
    //find the title element and create a DropDownList bound to the all event titles
    e.container.find("[name=title]").removeClass("k-input").kendoDropDownList({
        dataTextField: "AbsenceName",
        dataValueField: "AbsenceName",
        dataSource: new kendo.data.DataSource({
            transport: {
                read: {
                    url: ('@Url.Action("AbsenceTypeRead","Schedule")'),
                    dataType: "json"
                }
            }
        })
    });
};
Tags
Scheduler
Asked by
Sean
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Sean
Top achievements
Rank 1
Share this question
or