Reload Flexgrid

Posted by: feniksreborn on 9 March 2018, 5:46 am EST

    • Post Options:
    • Link

    Posted 9 March 2018, 5:46 am EST

    Hello,

    Angular 5

    Typescript

    Wijmo: 5.20173.409

    Is it possible to reload the flexgrid control?

    I have next example.

    <wj-flex-grid [itemsSource]=“data” [selectionMode]=“row” class=“grid” #flex [headersVisibility]=“‘Column’”>

       <wj-flex-grid-column *ngIf="true" [header]="''" [isReadOnly]="true" [width]="30">
            <ng-template wjFlexGridCellTemplate [cellType]="'Cell'" let-cell="cell">
               <input class="wj-cell-check" type="checkbox" #isChecked [(ngModel)]="isCheck" (click)="onMultipleSelectedItem(cell, $event)"/>
            </ng-template>
        </wj-flex-grid-column>  
    

    The problem: I have two buttons to switch data in flexgrid. So when the user clicks on the first button he will get data with some checkboxes - he can check the items and everything is ok. But when he chooses second button the data are reloaded (new data arrived) but checkboxes are not reset, flexgrid remember the old check items.

    I try next steps to refresh flexgrid:

        this.flex.invalidate();
        this.flex.refresh();
    

    Any idea how to reset checkbox state on button click?

    Thank you

  • Posted 9 March 2018, 9:24 am EST

    I have made a plunker example

    http://plnkr.co/edit/knq0mMye6HbfTkVvCzs5?p=preview

    Steps:

    1. Check for example first two checkboxes

      2 click on button 'change source"

    Issue - checkboxes are still checked? Checkboxes should be unchecked.

    Any idea how to resolve this issue?

    Thank you

  • Posted 12 March 2018, 1:30 am EST

    Hi,

    Sorry,We couldn’t trace the steps in plunk you provided as we were unable to find change source button.

    However here is an example which changes the source of flexgrid on button click.

    http://plnkr.co/edit/8jmOIAur4dHwUrXZeaPU?p=preview

    Please let us know if this solves your problem or update plunk to reproduce the problem you are facing.

  • Posted 12 March 2018, 3:32 am EST

    No,

    this is the common example that you provide me.

    Here is the plunker, try to reproduce Steps:

    1. Check for example first two checkboxes

      2 click on button 'change source"

    http://plnkr.co/edit/knq0mMye6HbfTkVvCzs5?p=preview

    Thank you

  • Posted 12 March 2018, 6:20 am EST

    Hi,

    FlexGrid only updates the DOM Tree when there’s a change in value.Since checkboxes are not bound to any source, they were not updated for performance optimization

    You can however bind them to a source and reinitialize them

    Please refer to the update plunk and let us know if it worked for you

    http://plnkr.co/edit/iMCZVdsIiO7bThI7BnCZ?p=preview

Need extra support?

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

Learn More

Forum Channels