igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Excel style filter runtime error with "date" type

Open catull opened this issue 6 years ago • 1 comments

Description

Runtime error when clicking on the search icon with Date field, with [filterMode]="'excelStyleFilter'"

  • igniteui-angular version: 9.0.0-beta.7
  • browser: Chrome 79.0.3945.79 (Official Build) Built on Ubuntu , running on LinuxMint 19.3 (64-bit)

Steps to reproduce

  1. Create component with Date field
  2. Define HTML as below
  3. Click on the Date field header icon once, click on it again
  4. Click on that icon, again

Somehow, it does not happen on the very first click, only on every click after that.

See the images below.

Result

The Date field filter is not popping up.

Expected result

The date field filter must re-appear when clicking the filter icon.

Attachments

Runtime error caught in Dev Tools:

image

The HTML markup:

  <igx-grid
    #grid
    [data]="publications | async"
    [autoGenerate]="false"
    [displayDensity]="'compact'"
    [allowFiltering]="true"
    [filterMode]="'excelStyleFilter'"
    [paging]="true"
    [height]="'808'"
    [rowHeight]="25"
    [rowSelectable]="false"
    [showToolbar]="true"
    [columnHiding]="true"
    [columnPinning]="true"
    toolbarTitle="Publications"
  >
    <!-- "canton" is a String field -->
    <igx-column
      [header]="'Canton'"
      [field]="'canton'"
      [resizable]="true"
      [filterable]="true"
      [sortable]="true"
      [movable]="true"
    ></igx-column>

   <!-- "publicationDate" is a Date field, physically, the attribute is received as a timestamp (long) -->
    <igx-column
      [header]="'Date'"
      [field]="'publicationDate'"
      [dataType]="'date'"
      [formatter]="formatDate"
      [resizable]="true"
      [filterable]="true"
      [sortable]="true"
      [hidden]="false"
      [movable]="true"
    >
    </igx-column>
  </igx-grid>

catull avatar Jan 23 '20 10:01 catull

Hello @catull

That behavior is expected since the excel style filtering is working with the real column’s data. You are seeing a human readable format due to the applied formatter. So, you need to convert your data first then bind it to the grid. Make sure to convert the publicationDate values from number to Date, then pass the data to the grid.

astaev avatar Feb 03 '20 12:02 astaev