jQuery UI Widgets Forums Grid Field attribute of filter is undefined on initial filter

This topic contains 8 replies, has 3 voices, and was last updated by  notedop 1 year, 6 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author

  • notedop
    Participant

    Hi,

    I have created the following fiddle to reproduce the issue:

    https://jsfiddle.net/notedop/7nmLo5ds/15/

    I am using some public JSON API just to proof a point; the actual filtering is not working with this public API which is as expected. The problem lays with the Data object that is available in the formatData function of the dataAdapter. When using an initial filter on the column, then the Data object has the Field attribute as undefined, which means I don’t know which field is being filtered from the FormatData function. This problem does not exist when manually filtering.

    The problem lays with the following:

    Define an initial filter by setting a Filter object to the column configuration of the grid, then when the FormatData function of the DataAdapter is called, the Data object should contain all the data that will be transmitted, including the filters. Unfortunately, on the initial load of the grid, the Field attribute of the filter definition is ‘undefined’.

    When clearing the filter manually and applying the filter again manually, then the Field attribute of the filter is defined as expected. (you’ll see the logs in the console)

    As a result I am not able to apply an initial filter on my grid as I cannot identify which field is being initially filtered (my code is dynamically generated). Initial filter as described here: https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/initialfilter.htm

    I think this is a bug…

    Note: I cannot use the ready : Function on the grid, because this will result in 2 calls to the backend of which the first call will be unfiltered. Filtering must be applied immediately when loading the grid.

    regards,
    Raoul


    notedop
    Participant

    Adding the console output

    {
      filtercondition0: "CONTAINS",
      filterdatafield0: undefined,
      filterGroups: [{
      field: undefined,
      filters: [{
      condition: "CONTAINS",
      field: undefined,
      label: "1",
      operator: "or",
      type: "numericfilter",
      value: "1"
    }]
    }],
      filteroperator0: 1,
      filterscount: 1,
      filtervalue0: "1",
      groupscount: 0,
      pagenum: 0,
      pagesize: 10,
      recordendindex: 10,
      recordstartindex: 0,
      undefinedoperator: "and"
    }
    undefined

    console output when manually setting a filter:

    {
      filtercondition0: "CONTAINS",
      filtercondition1: "LESS_THAN",
      filterdatafield0: undefined,
      filterdatafield1: "userId",
      filterGroups: [{
      field: undefined,
      filters: [{
      condition: "CONTAINS",
      field: undefined,
      label: "1",
      operator: "or",
      type: "numericfilter",
      value: "1"
    }]
    }, {
      field: "userId",
      filters: [{
      condition: "LESS_THAN",
      field: "userId",
      label: "2",
      operator: "and",
      type: "numericfilter",
      value: "2"
    }]
    }],
      filteroperator0: 1,
      filteroperator1: 0,
      filterscount: 2,
      filtervalue0: "1",
      filtervalue1: "2",
      groupscount: 0,
      pagenum: 0,
      pagesize: 10,
      recordendindex: 10,
      recordstartindex: 0,
      undefinedoperator: "and",
      userIdoperator: "and"
    }
    undefined

    notedop
    Participant

    Some more additional information; i have tried it with the latest 12.X, 13.X and 14.0.0 version and the behaviour is the same accross the last 3 versions. It does not seem to be recently introduced, if it’s a bug.


    admin
    Keymaster

    Hi notedop,

    Thank you for the feedback!

    We confirm the reported bug and it will be resolved in the next version of jQWidgets.

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/


    notedop
    Participant

    Awesome, thank you for the quick response and confirmation on the bug. I’m looking forward to next release 🙂


    notedop
    Participant

    I’ve had a look at the roadmap. Unfortunately it’s giving a 5 month window for the next release. Would you be able to share a bit more precise release schedule? Is there any patch or feature release planned for the near future? I’d like to determine if I should spent time on a work-around or if I should till the next release.

    If it’s going to take some time, do you have a suggestion for a work-around? The way i’m currently planning to use / using the filter is in a parent-child grid (using remote, virtual data), where-as the child grid will need to have a filter applied to the ID column based on the expanded parent row. This means that the filter is dynamically defined in the initrowdetails function of the parent grid and applied during the child grid initialization.


    ivanpeevski
    Participant

    Hello notedop,

    The bug will be resolved in the next release. Unfortunately we don’t have a precise date for our next version, but you can have a look at our release history to get an idea how often we release updates(generally once every 1-2 months). It is very unlikely that the next patch will take the full 5 month window.

    As for a work-around, will there be a problem to pass the initial parameters to the source url in initrowdetails?
    For example using the jsfiddle API you send us, replace “https://jsonplaceholder.typicode.com/posts” with “https://jsonplaceholder.typicode.com/posts?initialfilterdatafield={datafield}”. Then in the back-end, check if the field attribute is undefined. If it is, overwrite it with initialfilterdatafield.

    I hope this will be of help. If you face any other problems, please do not hesitate to contact us again.

    Best Regards,
    Ivan Peevski
    jQWidgets Team
    https://www.jqwidgets.com/


    notedop
    Participant

    with the recent update, i’ve verified this defect again. I took the original fiddle (see first post) and initially observed it was not fixed, however after closer inspection it seems that https://jqwidgets.com/public/jqwidgets/jqx-all.js points to version 14. After manually updating the dependencies to the CDN available version 15 I can now see the filter applied (atleast, console logs are showing the expected values, as well as the GET request is including the expected filter data. The endpoint used does not support this type of filtering, it was just for proving the defects point)

    Thank you for this long anticipated fix.


    notedop
    Participant

    Maybe one small remark; Allthough the filter is being applied on initial load, the filter value itself is not visible in the input box of the column.

    https://jsfiddle.net/neacvdr2/1/

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.