Using "delete" key to remove cell value not refreshing the flexgrid collection

Posted by: zam.abdulvahid on 23 October 2018, 9:38 pm EST

    • Post Options:
    • Link

    Posted 23 October 2018, 9:38 pm EST

    Hi Team,

    Have got a requirement in which I need to use the delete key in keyboard to remove a cell value from the flexgrid. This operation will trigger a service call and bring back updated records.

    But i could see that the collection.refresh() method is not updating the new values into the view.

    ~Zam

  • Posted 24 October 2018, 4:55 pm EST

    Hi Zam,

    Can you please tell us more about your implementation that how you are updating the new value? Is the new value just for a single cell or the whole grid is updated?

    It is recommended to use setCellData() method to update single cell value and update collectionView’s sourceCollection property in case a full update is required.

    Please refer to the following sample which demonstrates the same: https://stackblitz.com/edit/angular-jajmgs?file=app%2Fapp.component.ts

    ~Sharad

  • Posted 4 December 2018, 3:38 am EST - Updated 3 October 2022, 11:16 am EST

    Hi Sharad

    <wj-flex-grid #grid [itemsSource]="data" (initialized)="init(grid)" (keydown.delete)="delDown($event, grid)"
    (cellEditEnded)="cellEditEnded(grid, $event)"
     [selectionMode]="'Cell'">
    

    in the above code from your stackblitz link. Here one issue I faced is the cellEded and keydown.delete event is not same. Because of that some code like below are not working:

    let  oldCellData = event.data;
    event.camcel = true;
    

    Any solutions ?

    ~Pritam

    ref images attaced

  • Posted 4 December 2018, 4:59 pm EST

    Hi Pritam,

    Could you please let us know about your requirement/use case so that we may suggest you the possible solution accordingly

    Thank you

  • Posted 4 December 2018, 9:34 pm EST

    Hi Sharad,

    Our requirement is for the delete key we don’t want to attach an extra event. delete key operation should also been handled through cellEditEnded method.

    We have tried to replicate the issue …

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

    please check and reply

    ~ Pritam

  • Posted 6 December 2018, 7:37 pm EST

    Hi Pritam,

    Please call grid.collectionView.commitEdit() method to end update on collectionView and then call grid.collectionView.refresh() method to update grid with new data.

    Please refer to the following updated sample: https://stackblitz.com/edit/angular-pp3zvy?file=app%2Fapp.component.ts

Need extra support?

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

Learn More

Forum Channels