itemFormatter is not called

Posted by: mark.goldin on 2 December 2019, 7:35 am EST

  • Posted 2 December 2019, 7:35 am EST

    I have the following column definition:

    <wj-flex-grid-column [binding]="'LastUpdated'" [itemFormatter]="formatDate" [width]="110" align="center">
          <ng-template wjFlexGridCellTemplate cellType="ColumnHeader">
            <p class="wj-header-wordwrap">Last Updated</p>
          </ng-template>
      </wj-flex-grid-column>
    

    and this in ts file:

    formatDate(panel, r, c, cell) {
        console.log(cell);
      }
    

    formatDate is not getting called. Any idea why?

    Thanks

  • Posted 2 December 2019, 11:34 pm EST

    Hi Mark,

    The itemFormatter is not called because it is a property of the and not of the . So you will need to update the code as follows:

    <wj-flex-grid [itemFormatter]="formatDate">...</wj-flex-grid>
    

    And then you can add a check in the formatDate method so that it will only run for the required column:

    formatDate(panel, r, c, cell) {
    	if(panel.columns[c].binding === 'LastUpdated') {
    		console.log(cell);
    	}
    }
    

    But, if you are using cell templates for a column, you can directly customize the cell in the

    Regards,

    Ashwin

Need extra support?

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

Learn More

Forum Channels