Autocomplete Kendo Control I don't want to show "No Data found" when no matching records
Asked Answered
S

3

6

I have a autocomplete kendo control which I use with Angular, its working as expected but I don't want to show the "NO DATA FOUND" list when there are no records match the text that the user enter.

I find the option k-no-data-template but this set the template in case no data was found.

Basically I want to show the list only if there are match results.

Snider answered 1/12, 2016 at 16:6 Comment(0)
E
7

You can try this:

noDataTemplate: ''

for example

$("#autocomplete").kendoAutoComplete({
   dataSource: [
     { id: 1, city: "Bangalore" },
     { id: 2, city: "Pune" }
  ],
  dataTextField: "city",
  noDataTemplate: ''
});

So here, No Data found message won't come and even if you want to customize it put then:

noDataTemplate: 'customized message'  // if you want to show your custom message to user

Hope it work for you.

Electrosurgery answered 1/12, 2016 at 18:55 Comment(2)
If you are using Angular you can seet the option k-no-data-template="''"Snider
Simple and effective suggestion :) didn't think of it. Thanks.Mikimikihisa
S
0

You can set the option k-no-data-template="''"

Snider answered 24/5, 2018 at 8:36 Comment(0)
M
0

You can set this globally by css/sass:

.k-nodata
  *
    display: none
  &:after
    content: 'your custom text'
Meilen answered 6/8, 2019 at 13:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.