When creating Dataset controls, it's quite common to be want to have full control over the columns and filtering so that the data can support the custom visual being rendered.
Currently:
1. If we add a custom control to a view, this works well until the user uses the 'Quick Find' box, and then the columns are reset to be the 'Quick Find' view rather than the view columns for the specific view. This isn't specifically an issue with PCF since it's always been the case, but it's particularly troublesome for custom visuals - especially in light of not being able to hide the quick find box on home page grids.
2. If the dataset control wants to control it's own filtering, there is no supported way of reading the current filtering and adding more filters. I can see functions to get/set filters but there isn't any documentation around these.
Solved! Go to Solution.
hi Scott,
the sample control I attached previously has a <property-set> in the manifest
<data-set name="simpleTableGrid" display-name-key="SimpleTableGridProperty">
<property-set name="searchField" required="true" display-name-key="SearchField_Display_Key" description-key="SearchField_Description_Key" usage="bound" of-type-group="SingleLineGroup" />
</data-set>
Once you import the control, at customization time, you choose to configure the property-set to any candidate field of that entity (No need to guarantee the field is on the view). Then that field will be synced down in context.parameters.simpleTableGrid.columns. And value will sync down associatedly.
Would u mind to try it?
Bump!
It would be good to get some documenation around 'addFilter' and confirmation that using 'addColumn' to work around the Quick Find issue is fully supported.
hi Steve,
Yes, thanks for bring this up!
1) We do not have well documented the 'addColumn', as well as other data-set code, essentially it adds the 'attribute', then call refresh, then next time the column & all the column data will sync down. I apology for the inconvenience bring to u. In the mean time, feel free to post question in forum or directly send me email achen@microsoft.com.
2) Regarding the view changed to QuickFind view but the instance not expired. This worth more discussion. I will follow up on this
3) I think to achieve ur demand, please see if you could use <property-set>, which will always sync down the designated column regardless the column is on the view. It's view agnostic.
Let's say in manifest, it's
<data-set name='data-set1'>
<property-set name='property-set1' />
</data-set>
Once u bing the 'property-set1' to any data-type combatible attribute, say 'field1',of that entity through customization UI. Then 'field1' is always in columns and its data will sync down regardless how we switch the view.
And the filtering logic could be written directly use 'property-set1', not 'field1'. I will share a sample code by today.
<property-set> under <data-set> is really interesting to me. Thanks for sharing.
1) Attached is the sample code, which will indicate how to use the <property-set> to do filtering. It actually used to do sorting as well
The code is at about line 229. I have provided two options
2) Regarding the issue that whenever it switch to QuickView, then switch back. The instance has been reinitialized. This is by our design because the view has changed, so it should be reinitialized
3) If one want to keep consistency between the switch, we could use context.mode.setControlState to cache the info. And you could get the info once init at the 'state'
Feel free to let me know if there are more questions
Excellent stuff - thanks @AnqiChen - sample shows using the filtering which is really good. Would you be able to create a sample showing how to use property-sets inside a dataset to ensure the columns are always available nomatter what the view selected?
Currently we use addColumn but I expect that this causes an extra refresh of the data.
Regarding the quick search - when showing a PCF I would have expected that it simply adds a filter and refreshes rather than switching - but this behaviour has been like this since forever!
Once we have the ability to hide the quick search then I guess it'll make things easier. Currently it's a jarring UX for the user if they search and their entire view is refreshed.
hi Scott,
the sample control I attached previously has a <property-set> in the manifest
<data-set name="simpleTableGrid" display-name-key="SimpleTableGridProperty">
<property-set name="searchField" required="true" display-name-key="SearchField_Display_Key" description-key="SearchField_Description_Key" usage="bound" of-type-group="SingleLineGroup" />
</data-set>
Once you import the control, at customization time, you choose to configure the property-set to any candidate field of that entity (No need to guarantee the field is on the view). Then that field will be synced down in context.parameters.simpleTableGrid.columns. And value will sync down associatedly.
Would u mind to try it?
Is it possible to render PCF control for QuickFind results of view?
Yes - but you will need to bind the control to the quick find results because it's a different view.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |