Posted 14 September 2017, 11:08 am EST
Thanks Manish. I am able to solve my issue. flexGrid.groupHeaderFormat = ‘{myname}’; just the code to make sure the default formatter doesnot work. if I give flexGrid.groupHeaderFormat = ‘’; I am getting nothing and if I give flexGrid.groupHeaderFormat = ‘{}’; I am getting {} so I gave flexGrid.groupHeaderFormat = ‘{myname}’;
In my sample application everything is working fine. But when I integrate that in my main application I am having issue where first row group is selected. In my main application the below is scenario
User selects one account using check box and clicks a button. Then I make a http.get service call to get data from java service. After getting response I massage it and create my itemsSource collection. I use grouping for this.
Please see below code in my typescript file
filteredObjects = trackingObjects.filter(item => item.value === true);
if(filteredObjects !== null && filteredObjects !== undefined && filteredObjects.length > 0
&& filteredObjects.length === trackingObjects.length) {
//we got all results
const viewAccountControls = this.prepareItemsSourceForAccountControlsFlexGrid(accountsControls);
this.wjControlsFlexGridItemsSource = new wjcCore.CollectionView(viewAccountControls);
this.wjControlsFlexGridItemsSource.groupDescriptions.push(new wjcCore.PropertyGroupDescription('accountNumber'));
this.wjControlsFlexGridItemsSource.moveCurrentToPosition(-1);
this.showLoader = false;
}
This is in html
<wj-flex-grid #accountsControlsFlexGrid [itemsSource]="wjControlsFlexGridItemsSource" [selectionMode]="5" [showGroups]="true" [isReadOnly]="false" (formatItem)="wjFlexGridItemFormatter(accountsControlsFlexGrid, $event, wjControlsFlexGridItemsSource)"
[headersVisibility]="1">
<wj-flex-grid-column header="Select" binding="select">
<input type="checkbox" enabled />
</wj-flex-grid-column>
<wj-flex-grid-column header="ID" binding="id" isReadOnly=true></wj-flex-grid-column>
<wj-flex-grid-column header="Name" binding="name" isReadOnly=true></wj-flex-grid-column>
</wj-flex-grid>
If I use like below I am getting itemsSource undefined since that is true.
ngAfterViewInit() {
this.wjControlsFlexGridItemsSource.moveCurrentToPosition(-1);
}
My question is where I need to give this.wjControlsFlexGridItemsSource.moveCurrentToPosition(-1); in scenario where you show the flexgrid with column headers but no row and when user clicks some button fetch records from database and bind to flexgrid. I tried many ways but none useful.