Flex sheet column background color change

Posted by: bhati.bhati on 20 June 2019, 12:39 am EST

    • Post Options:
    • Link

    Posted 20 June 2019, 12:39 am EST

    Hi,

    I want to change the background color of bounded column in flex sheet. I have tried with [itemFormatter]=“formatItem” but its not invoked. A sample code for this and changing foreground color of cell would be helpful.

    Thanks and Regards

    Deepak Bhati

  • Posted 20 June 2019, 9:58 pm EST

    Hello,

    Please refer to the sample below that demonstrates how you use the itemFormatter to change the background color of a cell:

    https://stackblitz.com/edit/angular-wuwz13

  • Posted 24 June 2019, 9:19 pm EST

    Thanks abhishek,

    its working for me, can I invoke formatItem at runtime after binding my data on button click?

    Regards,

    Deepak

  • Posted 24 June 2019, 10:00 pm EST

    Hello,

    You may simply add a button and handle its click event. In the click event, assign the data source as the itemsSource of the sheet of FlexSheet and also assign the formatItem method as the itemFormatter of the FlexSheet. Please refer to the code snippet below:

    HTML:

    <wj-flex-sheet #formatSheet (initialized)="formatSheetInit(formatSheet)">
        <wj-sheet name="Data"  [rowCount]="20" [columnCount]="8"></wj-sheet>
    </wj-flex-sheet><br><br>
    <button (click)="bindData()">Bind Data</button>
    

    TS:

    bindData() {

    this.formatSheet.selectedSheet.itemsSource = this.source;

    this.formatSheet.itemFormatter = this.formatItem;

    }

    You may also refer to the sample below:

    https://stackblitz.com/edit/angular-3nxbxe

  • Posted 25 June 2019, 8:37 pm EST

    Thanks abhishek , its working for me.

Need extra support?

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

Learn More

Forum Channels