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
To set the new row at top, wijmo grid provides a property
newRowAtTop
.Modify your code like below:
Note the
[newRowAtTop] = "true"
part in above code.Following description of
newRowAtTop
is copied from this link: