I am trying to add a new empty row at the beginning of grid on external button click. Grid is showing perfectly fine.
<wj-flex-grid #flex
[itemsSource]="data"
[isReadOnly]="true"
[headersVisibility]="'Column'"
[selectionMode]="'ListBox'"
(selectionChanged)="gridSelectionChange($event, flex)"
(loadedRows)="onGridLoaded($event)">
</wj-flex-grid>
and data using collectionView
:
this.data = new wjcCore.CollectionView(records);
Using [allowAddNew] = 'true'
, It adds new row in bottom by default.
But I want to add at beginning on button click.
Updated:
addNewRow(ctl) {
this.data.addNew();
}
where addNewRow
working fine but adding in bottom:
<a (click)="addNewRow(flex)">add new</a>
Please help how I can achieve this.
Thanks