Skip to content

Commit ca27203

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 39ff085 commit ca27203

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

src/kendo.combobox.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ var __meta__ = { // jshint ignore:line
541541

542542
_select: function(candidate, keepState) {
543543
var that = this;
544+
544545
candidate = that._get(candidate);
545546

546547
if (candidate === -1) {
@@ -719,6 +720,10 @@ var __meta__ = { // jshint ignore:line
719720
loweredText = loweredText.toLowerCase();
720721
}
721722

723+
if(that.dataItem() && that._text(that.dataItem()) === text){
724+
return;
725+
}
726+
722727
that._select(function(data) {
723728
data = that._text(data);
724729
if (ignoreCase) {

tests/combobox/virtualization.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,5 +475,40 @@
475475
}
476476
assert.isOk(noErrors);
477477
});
478+
479+
it("doesn't sync value with text when mapValueTo dataItem and dataItem is selected", function() {
480+
var noErrors = true;
481+
var dataSource = new kendo.data.DataSource({
482+
transport: {
483+
read: function(o) {
484+
o.success([{text: "asd", value: 1}]);
485+
}
486+
}
487+
});
488+
dataSource.read();
489+
490+
var combobox = new ComboBox(select, {
491+
close: function(e) { e.preventDefault(); },
492+
height: CONTAINER_HEIGHT,
493+
animation: false,
494+
filter: "contains",
495+
dataTextField: "text",
496+
dataValueField: "value",
497+
dataSource: dataSource,
498+
virtual: {
499+
valueMapper: function(o) { o.success({text: "foo", value: 2}); },
500+
itemHeight: 20,
501+
mapValueTo: "dataItem"
502+
}
503+
});
504+
505+
combobox.value(2);
506+
507+
assert.equal(combobox.dataItem().text, "foo");
508+
509+
combobox.text("foo");
510+
511+
assert.equal(combobox.value(), 2);
512+
});
478513
});
479514
}());

typescript/kendo.all.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for Kendo UI Professional v2019.2.514
1+
// Type definitions for Kendo UI Professional v2019.2.618
22
// Project: http://www.telerik.com/kendo-ui
33
// Definitions by: Telerik <https://github.com/telerik>
44
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

0 commit comments

Comments
 (0)