Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 78072

Setting value() after (re)read selects a value not in list

$
0
0

Here's what I ended up with. It appears that the drop down list's items are not yet repopulated when the dataBound event fires, but the dataSource's data is, so I was able to use that. Still seems a bit hacky though.

functionloadCodeDropdownList() {
    varcodeList = $("#CodeDropDown").data("kendoDropDownList");
    varoldVal = codeList.value();
    if(oldVal != null&& oldVal != "") {
        codeList.one("dataBound", function(e) {
            vardata = codeList.dataSource.data();
            varnewVal = "";
            for(vark = 0; k < data.length; k++) {
                if(oldVal == data[k].Code) {
                    newVal = oldVal;
                    break;
                }
            }
            codeList.value(newVal);
            if(newVal == "") {
                codeList.trigger("change");
            }
        });
    }
    codeList.dataSource.read(CodeDropDownData());
}

Viewing all articles
Browse latest Browse all 78072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>