Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I have some codes written in Javascript as follow.
The purpose is to auto select the combobox first value when it has only one(1) value.
I tested my codes in Kendo Dojo and it worked. But not when I run the codes at my local PC using debug mode.

JavaScript
var arr = [];
arr.push('JMT');

$('#cmbTesting').kendoComboBox({
   placeholder: "Select",
   dataSource: arr,
   dataBound: function (e) {
     if (e.sender.items().length == 1) {
        this.select(0);
     }
   },
});


What I have tried:

1. Tried remove placeholder but not the root cause here.
2. Ctrl+F5 to refresh not not working as well.
3. Explicitly hardcoded the dataSource: ['JMT'] but not working as well.
Posted
Comments
Jamie888 29-Apr-22 4:55am    
4. I tried to put alert('trigger here'); inside the if (e.sender.items().length == 1){}. It prompted but not executing the this.select(0);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900