Filter with no match stops the filter input field from showing

2 posts, 0 answers
  1. Patrick
    Patrick avatar
    1 posts
    Member since:
    Feb 2015

    Posted 13 Nov 2015 Link to this post

    Hello, I'm using a single DropDownList which is bound to remote data. It all works fine except from when the filter string doesn't match with any records in the database. How to reporoduce a bug, step by step:

    1. Click on the data bound DropDownList component.

    2. Write a filter string that returns no records

    3. Click outside of the component to DropDownList close it

    4. (issue) Click again to "open" the DropDownList component and change the filter --> after a loading gif stops spinning, the component isn't shown nor the filter input field


    How to fix the issue?

    A workaround came to my mind where I could modify the results when server would return 0 rows to insert a single row with some rubbish data but that is not acceptable.

     Component setup:

    02.      filter: "startswith",
    03.      dataTextField: "customer_name",
    04.      dataValueField: "id",
    05.      dataSource: {
    06.          type: "json",
    07.          serverFiltering: true,
    08.          transport: {
    09.              read: function(options) {
    10.                $.ajax({
    11.                  url: "api/serviceXY.php",
    12.                  dataType: "json",
    13.                  type: 'post',
    14.                  data: 'filter=' + customerFilter,
    15.                  success: function(result) {
    16.                    options.success(result);
    17.                  },
    18.                  error: function(result) {
    19.                    options.error(result);
    20.                  }
    21.                });
    22.              }
    23.          }
    24.      },
    25.      filtering: function(e) {
    26.        if (typeof e.filter !== 'undefined') {
    27.          console.log(e.filter);
    28.            customerFilter = e.filter.value;
    29.        }
    30.      }
    31.  });

  2. Nencho
    Nencho avatar
    1446 posts

    Posted 17 Nov 2015 Link to this post

    Hello Patrick,

    I am afraid that I was unable to replicate the described issue, base on the provided information and code snippet. This is why, I would like to ask you to provide us with a sample dojo, where your implementation is applied and the problematic behavior resides. Thus we would be able to replicate it and determine whether it is a bug.

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