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

[Solved] Dropdown Error when datasource returns no record

1 Answer 320 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ti
Top achievements
Rank 1
Ti asked on 23 Mar 2015, 04:57 PM
Hi Guys,

I have a dropdownlist inside a grid which have a remove datasource. When my datasource lenght is zero, I can't do anything in the grid. The dropdownlist keep opened. 

Here an example based on kendo custom edit example

http://dojo.telerik.com/atObU

Try to select a new category, a then, try to edit a different category. It doesn't work.

Thanks for your attention and sorry for my english :P

1 Answer, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 25 Mar 2015, 09:42 AM
Hello,

The reason for current behavior is that there is required validation for the current cell which prevents the cell from closing. You can either remove the "required" attribute from the editor or specify the validation message position in order to be visible:

function categoryDropDownEditor(container, options) {
   
  $('<input required id="Category" name="Category" data-text-field="CategoryName" data-value-field="CategoryID" data-bind="value:' + options.field + '"/>')
  .appendTo(container)
  .kendoDropDownList({
    autoBind: false,
    dataSource: {
      data: []
    }
  });
   
  $('<span class="k-invalid-msg" data-for="Category"></span>').appendTo(container);
}

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Ti
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or