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

kendo issues in

1 Answer 223 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
pavan asked on 27 May 2019, 12:22 PM

I am facing 2 problems in kendo multiselect dropdown for php-

1)How to sort the items which come in dropdown by alphabet.Even if we type a letter,the dropdown items should begin with that letter and show in a alphabetically sorted order.


2)when we click in kendo multiselect,dropdownlist should not appear below.It should appear only if we type a letter and the corresponding letter matches should appear.

Kendo multiselect code-

                placeholder: \"Key Skills\",
                dataTextField: 'text',
                dataValueField: 'value',
                dataSource: data,
                dataBound: onDataBound,
                filtering: onFiltering,
                deselect: onDeselect,
                select: onSelect,
                change: onChange,
                close: onClose,
                open: onOpen,
                filter: \"startswith\"

How to solve these issues?

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 29 May 2019, 10:00 AM
Hello Pavan,

Please check this Dojo example, demonstrating all the things asked using data from the demo examples in our documentation.
  • The alphabetical sort in the dropdown can be achieved by setting the sort configuration of the DataSoure. In the provided example we are doing this with the marked in yellow snippet: 
dataSource: {
  type: "odata",
  serverFiltering: true,
  sort: {
    field: "ProductName",
    dir: "asc"
In this example, we are telling the DataSource to sort the ProductName field in ascending order. This field should be changed depending on the field in the DataSource by which we want the dropdown elements to be sorted. 
  • To make the dropdown appear only when there is a match between the entered and the corresponding letter we can use the noDataTemplate configuration and set it to false
noDataTemplate: false
  • Stopping the dropdown to appear on click is achieved with this part of the code:
open: function(e){
  var sender = e.sender;
  var input = sender.input;
  if(input.val().length === 0 || 'Select products...' === input.val()){
What we do here is to check what is the value of the MultiSelect's input and preventing the opening of the dropdown. As it could be seen there is a code marked in yellow above. This text should be the same as the one set for the MultiSelect's placeholder. If your scenario the "Select products..." should be changed with "Key Skills".
  • There is one last thing done in the Dojo example and it is to prevent the dropdown opening when the user writes something and then delete the entered data from the input. This prevention is done with the following snippet

multiselect.input.on("keyup", function(e){

I hope that the above example and description resolve the submitted issues. If you have questions regarding the implementation, please let me know. 

Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question