DropDownList as Custom Editor for grid, unable to set initial value/text

1 posts, 0 answers
  1. GungFooMon
    GungFooMon avatar
    17 posts
    Member since:
    Apr 2012

    Posted 24 Apr 2012 Link to this post


    I am trying to define an initial value for an ajax datasource populated dropdownlist in an editor definition function for a grid column.
    I have tried setting it via the text() function after initialization but it seems to get "changed" to index 0 as soon as the datasource is bound to the widget..
    I also tried using a callback for the select() function, setting a value() as well as using the text() method both right after the initialization (which seems to get overwritten upon loading the data) and inside a "change" even handler for the transport attribute of the datasource; none of which helped.. please advise!

    here a snippet of code i used:

        function(container, options) {
          $('<input id="' + options.field + '" />')
                    dataTextField: 'text',
                    dataValueField: 'value',
                    dataSource: {
                        change: function(e) {
                            var item = null;
                            $('#'+options.field).data('kendoDropDownList').ul.children().each(function(idx, elem) {
                                if($(elem).html() == options.model.rel_type) item = $(elem);
    // does not select anything even tho console.log() proves that it is the correct element
                        transport: {
                            read:  {
                                url: '/relationdata/relation/relType',
                                dataType: 'json'

    the grid loads fine but nothing is selected in turn.
Back to Top