No Results Found Text when Result Set is Empty

2 posts, 0 answers
  1. Joshua
    Joshua avatar
    2 posts
    Member since:
    Jun 2014

    Posted 11 Jun 2014 Link to this post

    I am looking for functionality like the Multiselect below: US State Select -> type x = 'No Results found for x' 

    I have built a work around providing data from the back end and on select if the id is 'noresults' I set the value of the click to forget about the selection. However I find it hard to believe that there is no option for this as it seems to be a common use case. Is there a better way to handle this than I described as my work around? I am using the MVC Helpers for the majority of this code.

    Thanks in advance,

    - Josh
  2. Alexander Popov
    Alexander Popov avatar
    1411 posts

    Posted 13 Jun 2014 Link to this post

    Hello Josh,

    I am afraid that this scenario is currently not supported out of the box. I would recommend using the following approach as a workaround:
    1. Subscribe to the RequestEnd event of the MultiSelect's DataSource
    2. Once the event is triggered check whether there are any items in the response argument
    3. If there are not any, then add one, with the desired message in the text field. For example: 
      function onRequestEnd(e) {
          var ms = $("#products").getKendoMultiSelect();
          if (!e.response.length) {
              e.response.push({ ProductName : "No results", ProductID : 0 });
    4. Subscribe to the Change event of the MultiSelect and check whether the selected item text matches the "No results" one
    5. If it does, call the event's preventDefault method: 
      function onSelect(e) {
          if (e.item.text() == "No results") {

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top