Getting a reference to a flex-grid's flex-grid-filter

Posted by: lxrp-bst on 11 January 2021, 6:03 pm EST

  • Posted 11 January 2021, 6:03 pm EST

    I's using MVC Tag Helpers to setup a c1-flex-grid and associated c1-flex-grid-filter. It works fine, but when I want to reference the filter in java script (for example to add a handler) I cant figure out how to do it.

     
    var theGrid = wijmo.Control.getControl('#ff');
    theGrid.filter //undefined
    theGrid.collectionView.filter //undefined


    I've seen theGrid.filter and theGrid.collectionView.filter used in some examples but they don't work for me.
    Most other examples generate both the grid and the filter in js using wijmo, but because I am using the ASP tag helpers this isn't an option.

    I know I can use the event binding properties in the tag helpers (e.g. filter-changing) but I am sure there are plenty of situations where I need to get a direct reference to filter, is this possible in java script?

  • Marked as Answer

    Replied 12 January 2021, 6:05 pm EST

    Hi,
    You may get the FlexGridFilter reference in JS code using the following code snippet:
     <c1-flex-grid auto-generate-columns="true" is-read-only="true" height="500px" id="flexgrid1">
    ....
    <c1-flex-grid-filter id="filter" default-filter-type="Both" filter-changing="filterChanging" filter-applied="filterApplied"></c1-flex-grid-filter>
    </c1-flex-grid>
    <script>
    c1.documentReady(function (e) {
    var grid = wijmo.Control.getControl("#flexgrid1");
    filter = c1.getExtender(grid, "filter");
    })
    </script>

    Regards,
    Manish Gupta
  • Replied 19 January 2021, 3:26 pm EST

    That worked perfectly, thanks!
Need extra support?

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

Learn More

Forum Channels