We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

custom multiselect grid filter template blinking

Hi I'm Pablo and I'm facing an issue adding a custom filter to a column, using a filter template.
the problem:
when I click con the multiselect, it blinks and fades away (might be related to the tabindex), this is the code:

.html
<ejs-grid #grid [dataSource]='dataGrid | async' [allowPaging]="true" [pageSettings]='pageSettings' [filterSettings]='filterOptions'
          [allowSorting]="true" [allowFiltering]="true" [allowGrouping]="true" height=315 (dataStateChange)='dataStateChange($event)'>
  <e-columns>
    <e-column field='contact' headerText='Contact' textAlign='left' width=150></e-column>
    <e-column field='action' headerText='Action' width=100>
      <ng-template #filterTemplate let-data>
        <ejs-multiselect id='actionsMultiselectFilter' [mode]="actionsSelectMode" [enabled]="true"
                         (change)=onActionMultiselectFilterChange($event) [dataSource]='actionsData' [fields]='actionsFields'
                         [placeholder]="actionsPlaceholder">
        </ejs-multiselect>
      </ng-template>
    </e-column>
    <e-column field='modified' headerText='Mod. Date' textAlign='left' width=120 [allowFiltering]="false"></e-column>
    <e-column field='modifiedBy' hea...
.ts
  @ViewChild('grid')
  public grid: GridComponent;  
  public actionsData: Object[] = [
    { id: '1', action: 'Add' },
    { id: '2', action: 'Modify' },
    { id: '3', action: 'Delete' },
    { id: '9', action: 'Merge record' },
    { id: '10', action: 'Create record' }
  ];
  public actionsFields: Object = { text: 'action', value: 'id' };
  public actionsPlaceholder: string = 'Select actions..';
  public actionsSelectMode : string = 'CheckBox';
  public onActionMultiselectFilterChange(args: any): void {
    this.grid.filterByColumn('action', 'equal', args.value);
  }

I used this as example
(if I press the input and holding move to the dropdown area, it stays and can filter and I get the right filters, thats part is ok )

thanks.

1 Reply

HJ Hariharan J V Syncfusion Team April 23, 2019 09:50 PM

Hi Pablo, 

Greeting from Syncfusion. 

We have validated the provided information and we suggest you to use the below way to resolve reported problem. In the below code example, we have bind open and close event for multi select dropdown  and handle the tab index.   

Please find the below code example for more information. 

<ejs-grid #grid [dataSource]='data' allowPaging='true' allowFiltering='true' [pageSettings]="pageOptions"> 
  <e-columns> 
    <e-column field='ProductName' headerText='Product Name' width='150'> 
      <ng-template #filterTemplate let-data> 
        <ejs-multiselect id='actionsMultiselectFilter' #multi [mode]="actionsSelectMode" [enabled]="true" (change)=onActionMultiselectFilterChange($event) 
          [dataSource]='actionsData' [fields]='actionsFields' [placeholder]="actionsPlaceholder" (open)='onOpen($event)' (close)='onClose($event)'> 
        </ejs-multiselect> 
      </ng-template> 
    </e-column> 
  </e-columns> 
</ejs-grid> 


onOpen(e) { 
  if (this.mulObj.element.parentElement.getAttribute('tabindex') === '-1') { 
     this.mulObj.element.parentElement.setAttribute('tabindex', '0'); 
  } 
 
} 
onClose(e){ 
  if (this.mulObj.element.parentElement.getAttribute('tabindex') === '0') { 
      this.mulObj.element.parentElement.setAttribute('tabindex', '-1'); 
      e.cancel = true; 
  } 
} 


Please get back to us if you need further assistance on this. 

Regards, 
Hariharan 


Loader.
Live Chat Icon For mobile
Up arrow icon