File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change 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} ( ) ) ;
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments