Skip to content

Commit

Permalink
Widget throws an exception when search in grouped list. Fixes telerik…
Browse files Browse the repository at this point in the history
  • Loading branch information
ggkrustev committed Jan 19, 2016
1 parent 1f3f347 commit e023618
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/kendo.dropdownlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ var __meta__ = { // jshint ignore:line

_selectNext: function() {
var that = this;
var data = that.dataSource.flatView().toJSON();
var data = that.dataSource.flatView();
var dataLength = data.length + (that.hasOptionLabel() ? 1 : 0);
var isInLoop = sameCharsOnly(that._word, that._last);
var startIndex = that.selectedIndex;
Expand All @@ -719,6 +719,7 @@ var __meta__ = { // jshint ignore:line
startIndex = normalizeIndex(startIndex, dataLength);
}

data = data.toJSON ? data.toJSON() : data.slice();
data = that._shuffleData(data, startIndex);

for (var idx = 0; idx < dataLength; idx++) {
Expand Down
18 changes: 18 additions & 0 deletions tests/dropdownlist/searching.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,4 +607,22 @@
dropdownlist.open();
dropdownlist.filterInput.val("or").keydown();
});

test("search select first match of grouped list", function() {
var data = [{text: "Foo", value: 1, type: "a"}, {text:"Bar", value:2, type: "b"}, {text:"Baz", value:3, type: "a"}];
var dropdownlist = new DropDownList(input, {
dataTextField: "text",
dataValueField: "value",
dataSource: {
data: data,
group: { field: "type" }
}
});

dropdownlist.wrapper.focus().press("b");
dropdownlist.wrapper.focus().press("b");

ok(dropdownlist.ul.children().eq(2).text(), "Bar");
ok(dropdownlist.ul.children().eq(2).hasClass("k-state-selected"));
});
})();

0 comments on commit e023618

Please sign in to comment.