Posted 14 September 2017, 12:12 pm EST
I have a custom template. I save columnLayout to the localstorage on updatedLayout event. But when I navigate back to the grid, none of my custom templates are applied. I am using Angular2 componets with version Wijmo-Enterprise.20172.334 standard edition.
See below, my code.
<wj-flex-grid #datagrid (initialized)="initialized(datagrid, e)" [itemsSource]="tradesView" [wjContextMenu]="ctxMenu" (cellEditEnded)="editDone($event)" (updatedLayout)="layout($event)"> <wj-flex-grid-filter #filter></wj-flex-grid-filter> <wj-flex-grid-column [header]="'Strategy'" [binding]="'StrategyName'" [isReadOnly]="true" [width]="100"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Side'" [binding]="'Direction'" [align]="'center'" [isReadOnly]="true" [width]="75"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Security'" [binding]="'SecurityName'" [isReadOnly]="true" [width]="275"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Trade Qty'" [binding]="'Quantity'" [isReadOnly]="true"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Trade Price'" [binding]="'TradePrice'" [isReadOnly]="true"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Label'" [binding]="'Label.LabelID'" [align]="'center'" [isReadOnly]="false" [width]="250"> <ng-template wjFlexGridCellTemplate [cellType]="'CellEdit'" let-cell="cell"> <wj-auto-complete #labelAutoComp [itemsSource]="labelsView" [placeholder]="'Start Typing..'" [selectedValuePath]="'LabelID'" [displayMemberPath]="'Label'" [(selectedValue)]="cell.value"> </wj-auto-complete> </ng-template> <ng-template wjFlexGridCellTemplate [cellType]="'Cell'" let-cell="cell"> {{cell.item.Label.Label}} </ng-template> </wj-flex-grid-column> <wj-flex-grid-column [header]="'Seq'" [binding]="'Label.LabelSeqID'" [align]="'right'" [isReadOnly]="true" [width]="75"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Label Qty'" [binding]="'Label.LabeledQuantity'" [align]="'right'" [isReadOnly]="true"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Label Price'" [binding]="'Label.LabeledTradePrice'" [align]="'right'" [isReadOnly]="true"></wj-flex-grid-column> <wj-flex-grid-column [header]="'Trade Date'" [binding]="'TradeDate'" [align]="'center'" [width]="'*'" [isReadOnly]="true" [format]="'d'"></wj-flex-grid-column> </wj-flex-grid>
layout(e: any) { if (this.grid) { localStorage['tradesColumnLayout'] = this.grid.columnLayout; if (this.grid.itemsSource) { var groupState = [], sortState = []; for (let description of this.grid.itemsSource.groupDescriptions) { groupState.push({ property: description.propertyName, }); } for (let description of this.grid.itemsSource.sortDescriptions) { sortState.push({ property: description.property, ascending: description.ascending }); } localStorage['tradesGroupLayout'] = JSON.stringify(groupState); localStorage['tradesSortLayout'] = JSON.stringify(sortState); } } }