Posted 11 June 2020, 7:03 pm EST
Hi,
I am having no luck setting a default groupDescriptions object when using a FlexGrid with the ImmutabilityProvider. It seems that itemsSource wants only an array.
Thanks.
Forums Home / Wijmo / General Discussion
Posted by: richard.herbert on 11 June 2020, 7:03 pm EST
Posted 11 June 2020, 7:03 pm EST
Hi,
I am having no luck setting a default groupDescriptions object when using a FlexGrid with the ImmutabilityProvider. It seems that itemsSource wants only an array.
Thanks.
Posted 12 June 2020, 1:59 am EST
Hi Richard,
The ImmutabilityProvider is used with immutable objects array. That is the only way which it can work. This module automatically converts the array into CollectionView internally. If you need to provide groupDescriptions initially, then you will need to handle the initialized event and push a new PropertyGroupDescription to the groupDescriptions array.
In the sample below:
https://www.grapecity.com/wijmo/demos/Grid/Data-binding/ImmutableData/Redux/EditableReduxGrid/react
add the following line in the GridView.jsx, onGridInitialized event:
onGridInitialized(s) {
// Attach group panel
this.groupPanelRef.current.control.grid = s;
s.collectionView.groupDescriptions.push(new wjCore.PropertyGroupDescription('country'));
}
You will also need to import the wjCore module. At the top of the file, add this line o of code:
import * as wjCore from '@grapecity/wijmo';
I hope this helps.
Regards,
Ashwin
Posted 12 June 2020, 5:04 am EST
Perfect, that’s what I was looking for - it works great. I did wonder where the CollectionView was hiding.
Thank you for the prompt response!