Note that there are some explanatory texts on larger screens.

plurals
  1. POSet the selected text or value for a KendoDropDownList
    primarykey
    data
    text
    <p>I'm using Durandal and Kendo UI. My current problem is the edit popup event on my grid. I cannot seem to set the selected value on my dropdown.</p> <p>I can debug and inspect, and I indeed do see the correct value of e.model.InstrumentName nicely populated.</p> <p>How can I set the value/text of those dropdowns in edit mode ?</p> <p>Here's my grid init:</p> <pre><code> positGrid = $("#positGrid").kendoGrid({ dataSource: datasource, columnMenu: false, { field: "portfolioName", title: "Portfolio Name", editor: portfolioDropDownEditor, template: "#=portfolioName#" }, { field: "InstrumentName", width: "220px", editor: instrumentsDropDownEditor, template: "#=InstrumentName#", }, edit: function (e) { var instrDropDown = $('#InstrumentName').data("kendoDropDownList"); var portfDropDown = $('#portfolioName').data("kendoDropDownList"); instrDropDown.list.width(350); // let's widen the INSTRUMENT dropdown list if (!e.model.isNew()) { // set to current valuet //instrDropDown.text(e.model.InstrumentName); // not working... instrDropDown.select(1); //portfDropDown.text(); } }, filterable: true, sortable: true, pageable: true, editable: "popup", }); </code></pre> <p>Here's my Editor Template for the dropdown:</p> <p>function instrumentsDropDownEditor(container, options) {</p> <pre><code> // INIT INSTRUMENT DROPDOWN ! var dropDown = $('&lt;input id="InstrumentName" name="InstrumentName"&gt;'); dropDown.appendTo(container); dropDown.kendoDropDownList({ dataTextField: "name", dataValueField: "id", dataSource: { type: "json", transport: { read: "/api/breeze/GetInstruments" }, }, pageSize: 6, select: onSelect, change: function () { }, optionLabel: "Choose an instrument" }).appendTo(container); } </code></pre> <p>thanks a lot Bob</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload