flexFridFilter.FilterType is defaulting to 3 after its set to 0 explicitly

Posted by: arobindhbalaji.viswanathan on 29 July 2024, 4:09 pm EST

    • Post Options:
    • Link

    Posted 29 July 2024, 4:09 pm EST

    Hello,

    I am trying to disable filter for selected columns in the grid. I so that by setting the flexFridFilter.FilterType to 0 explicitly in the code. However, I see that it is getting reset when the data loads into the grid and it defaults to flexFridFilter.FilterType =3. I was wondering what needs to be done to amke the grid the filter definition set in the code always. Here is a example of my code

    html:

    <wj-flex-grid-filter

    #filter

    (filterChanged)=“onFilterChanged(flexGrid, $event)”

    (editingFilter)=" this.editingFilter(filter, $event) "

    (initialized)=“this.initializeFilter(filter)”

    >

    TS:

    @ViewChild(‘filter’, { static: true })

    flexGridFilter!: wjcGridFilter.FlexGridFilter;

    this.dataService.Getdata().Subscribe((result)=>{

    this.griddatasource = new wjcCore.CollectionView(this.accountsList);

    this.disableFiltersForSSPUser();

    }

    );

    disableFilters() {

    const columns = [‘col C’, ’ col D’];

    columns.forEach((column) => {

    const col = this.flexGridFilter.grid.columns.getColumn(column);

    const cf = this.flexGridFilter.getColumnFilter(col, true);

    cf.filterType = 0;

    });

    this.flexGridFilter.apply();

    this.flexGridFilter.grid.refresh();

    }

  • Posted 31 July 2024, 5:21 am EST

    Hi,

    The recommended way to specify filters for specific columns in FlexGrid is by setting the ‘filterColumns’ property of the FlexGridFilter. Please refer to the following code snippet -

      <wj-flex-grid-filter
          #filter
          (initialized)="this.initializeFilter(filter)"
          [filterColumns]="['date', 'time', 'product']" 
        />

    The ‘filterColumns’ property contains the binding of the columns where you want the filter to be added.

    For more information checkout this API link: https://developer.mescius.com/wijmo/api/classes/Wijmo_Grid_Filter.Flexgridfilter.html#filtercolumns

    Here is a sample for your reference https://stackblitz.com/edit/angular-3zhpwb?file=src%2Fapp%2Fapp.component.html

    In case you need further assistance do let us know

    Thanks, and Regards

  • Posted 1 August 2024, 11:52 am EST - Updated 1 August 2024, 6:03 pm EST

    This worked, Thank you very much. However, I am trying to default the filter type to 2 where filter by condition/ value is disabled. I still see that the filter type is set to 3. Is there a way to achieve that?

  • Posted 2 August 2024, 8:57 am EST

    Hi,

    You can use set the ‘defaultFilterType’ property of the FlexGridFilter to 2 to get the desired results. You can refer to the following API link for more information about this property - https://developer.mescius.com/wijmo/api/classes/Wijmo_Grid_Filter.Flexgridfilter.html#defaultfiltertype.

    You can also do this for a particular column using ‘filterType’ property of the ColumnFilter like this - getColumnFilter(“binding”).filterType = 2. You can handle ‘initialized’ event of the FlexGridFilter for this purpose.

    For more information, checkout this API link - https://developer.mescius.com/wijmo/api/classes/Wijmo_Grid_Filter.Flexgridfilter.html#getcolumnfilter

     <wj-flex-grid
        #grid
        selectionMode="MultiRange"
        [showMarquee]="true"
        [alternatingRowStep]="0"
        [itemsSource]="data"
      >
        <wj-flex-grid-filter
          #filter
          (initialized)="this.initializeFilter(filter)"
          [filterColumns]="['date', 'time', 'productId']"
          [defaultFilterType]="2"
        />
      </wj-flex-grid>
      initializeFilter(filter: wjcGridFilter.FlexGridFilter) {
        filter.getColumnFilter('productId').filterType = 1;
      }

    Here is a sample https://stackblitz.com/edit/angular-3zhpwb?file=src%2Fapp%2Fapp.component.ts for your reference.

    If you need further assistance, reach out to us.

    Thanks, and Regards

  • Posted 2 August 2024, 4:16 pm EST

    Thanks that worked as well. Appreciate it!

Need extra support?

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

Learn More

Forum Channels