Filter/Sorts via code

Posted by: jrt on 19 July 2021, 5:19 pm EST

  • Posted 19 July 2021, 5:19 pm EST

    Hi,

    I’m evaluating many grids as I’m moving away from the the jquery depenendent slickgrid with the aurelia 1 framework. While I would love a pure declarative web component solution, I feel quite comfortable using purejs while you upgrade your web components. That said I need to deploy with the same feature set I currently have but I’m coming up short with the following

    1. filters via code

      The following filter works.

      let filter = new FlexGridFilter(this.theGrid);

      //0=us

      //strings 0 not set, 1 = equals,2 does not eq m 3 is >, 4 >=, 5 is >, 6 >=

      //numbers 0 not set, 1 = equals,2 does not eq m 3 Begin, 4 Ends, 5 constains

      filter.filterDefinition = ‘{ “defaultFilterType”: 3, “filters”: [{ “binding”: “country”, “type”: “value”, “filterText”: “”, “showValues”: {“0”: true } } ] }’;

      ==================
    2. I need to add the following

      {“defaultFilterType”: 5, “filters”: [{ “binding”: “downloads”, “type”: “value”, “filterText”: “”, “showValues”: {“5000”: true } } ]}

      this filtering country=‘US’ and downloads > 5000
    3. I also need to suppy multiple sorts

      product: assending

      downloads: assending

      I’ve tried quite a few things but have not succeeded.
    4. I would like to know then you will have cell templates available for the web component product as I need buttons and anchor links

      TIA

      John

      jrt@gtz.com

    the attached zip src.zip

  • Posted 19 July 2021, 9:11 pm EST

    Ok, I figured out the sort

    let sortDesc = new SortDescription(‘product’, false);

    this.theGrid.collectionView.sortDescriptions.push(sortDesc);

    let sortDesc2 = new SortDescription(‘active’, false);

    this.theGrid.collectionView.sortDescriptions.push(sortDesc2);

    async onClick(){

    // clear all sorts on btn click

    this.theGrid.collectionView.sortDescriptions.clear();

    }

  • Posted 20 July 2021, 10:16 am EST

    Nothing like solving your own problms

    Fixed multiple type filter

    filter.filterDefinition = ‘{“defaultFilterType”:3,“filters”:[{“binding”:“country”,“type”:“condition”,“condition1”:{“operator”:3,“value”:1},“and”:true,“condition2”:{“operator”:null,“value”:null}}, {“binding”:“downloads”,“type”:“condition”,“condition1”:{“operator”:2,“value”:20000},“and”:true,“condition2”:{“operator”:null,“value”:null}}]}’

  • Posted 21 July 2021, 12:02 am EST

    Hi John,

    First of all, I apologize for the delay in response. Thank you for evaluating Wijmo.

    Now coming to your issues, can you let me know what exact upgrades are you looking for in the web components version of Wijmo so that I can ask the concerned team whether it can be implemented or not.

    Regarding 1, 2, and 3, both of your solutions are correct and I am glad that you were able to implement the required behavior.

    Regarding 4, currently, cell templates are not supported in Web Components. I have forwarded an enhancement request for the same with internal tracking id WJM-20512. I will update you once I’ll have any more information.

    In the meantime, you can use the cellTemplate property of the Column class and CellMaker of wijmo.grid.cellmaker module to add buttons and links to the grid. Please refer to the demo below for reference:

    https://www.grapecity.com/wijmo/demos/Grid/CustomCells/CellMaker/Buttons/purejs

    https://www.grapecity.com/wijmo/demos/Grid/CustomCells/CellMaker/Hyperlinks/purejs

    Regards,

    Ashwin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels