cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elysy
New Member

Showing View Selector and Command bar on Subgrid Custom Compnonent

Hi!


I'd like to retain the view selector on the subgrid when I'm applying a dataset custom control just so I can switch between my custom control and ootb subgrid. This should be possible because when I set the ootb subgrid as the default control and I switch to my PCF control thru the subgrid view selector, the whole command bar still remains.
Any advice on how I can make this to work?

Cheers!

29 REPLIES 29

@AnqiChen @ScottDurow 

 

I tried to use the approach Scott suggest and it works correctly for alphabets and All keyword but for # it doesn't seems to work. Below is my code.

 

Where char is alphabet letter.

 

  var condition = null;
            if (char == "#") {
                let alphabets: string[]  = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
                condition = {
                    attributeName: "name",
                    conditionOperator: 8, //
                    value: alphabets,
                    entityAliasName: "opportunity",
                };
            }
            else {
                char = char + "%";
                condition = {
                    attributeName: "name",
                    conditionOperator: 6, //
                    value: char,
                    entityAliasName: "opportunity",
                };
            }
            const conditionArray = [];
            conditionArray.push(condition);
            this.contextObj.parameters.sampleDataSet.filtering.setFilter({
                // @ts-ignore
                conditions: conditionArray,
                filterOperator: 1, // Or
            });
            this.contextObj.parameters.sampleDataSet.refresh();

 

What am I doing wrong here ?

 

I also tried to use the keyword displayIndex:true and indeed it display the bar at the right side so as of now we can't use it.

I think the issue is that you are using the 'in' operator on the list of numbers - but actually you need to still use the like:

let alphabets: string[]  = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
                condition = {
                    attributeName: "name",
                    conditionOperator: 8, //
                    value: alphabets,
                    entityAliasName: "opportunity",
                };

 

This will only match opportunities that have a name EXACTLY equal to 1,2,3...

I would use the same approach you are using for the like - but add a list of conditions that are grouped in a filter OR group:

 

{
        "filterOperator": 1, // OR
	"conditions": [
		{
			"attributeName": "fullname",
			"conditionOperator": 6, // LIKE
			"value": "0%"
		},
		{
			"attributeName": "fullname",
			"conditionOperator": 6, // LIKE
			"value": "1%"
		},
		{
			"attributeName": "fullname",
			"conditionOperator": 6, // LIKE
			"value": "2%"
		},
		{
			"attributeName": "fullname",
			"conditionOperator": 6, // LIKE
			"value": "3%"
		}
		...
	]
}

 

@ScottDurow 

Yes I do tried with IN condition and array but this doesn't work .I was in assumption that it will take array directly.

 

let alphabets: string[]  = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
                condition = {
                    attributeName: "name",
                    conditionOperator: 6, //
                    value: alphabets,
                    entityAliasName: "opportunity",
                };

 

But after looping through list of condition not just passing the array it works.

 let numbers: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
                for (var num of numbers) {
                    num = num + "%";
                    condition = {
                        attributeName: "name",
                        conditionOperator: 6, // Equal or Under
                        value: num,
                        entityAliasName: "opportunity",
                    };
                    conditionArray.push(condition);
                }

 

Thanks for your response.

@AnqiChen @HemantG  can you confirm that this cds-data-set-options setting of dataset works in subgrids? I tried different combinations and nothing worked fine for me. I use CLI v1.1.6 and CDS v9.1.0000.10743. Here is piece of my manifest file:

<data-set name="exampleDataSet" display-name-key="exampleDataSet" cds-data-set-options="displayCommandBar:true;displayViewSelector:true;displayQuickFindSearch:true">
</data-set>

hi ,

 

Yes they should work well for subgrid. It might not show in CLI, but should show in product.

For ViewSelector and QuickFindSearch, u might need also to enable them in the form designer.

 

Also, the <data-set> should be the first property in the whole control.

 

 
 

@AnqiChen then I have an issue to report. I can confirm that I do have that setting in the dataset tag set and dataset is the first property in the manifest file. Also I can confirm that I have viewsector enabled in the subgrid with one different that I use "Selected Views" option instead of "All Views". Should I check anything else?

hi,

 

I test it myself and it seems workable right now.

Attached is the sample app solution that contains one PCF control, and the form with the PCF control. The app is 'TestAppForDataSet'.

 

Once you import the solution, just create a new record through 'New' and then Save. You should see Commandbar/ViewSelector/QuickFind there.

 

I am not sure about the issue at your environment, it could be:

1) The cds-data-set-options should be "displayCommandBar:true;displayViewSelector:true;displayQuickFind:true". It's displayQuickFind, not displayQuickFindSearch.

I am not sure if this is the issue, if this is the issue, it definitely is our bug

2) Or the environment is legacy? what's the build version of the environment? is it an OnPrem environment?

 

If still have issue, please let us know or create a ticket to us. So we could check in details.

 

 

@AnqiChen I was finally able to play with it myself and here are my results:

1. When you set the custom dataset control as a default one to be shown - view selector and search box are shown properly.

2. When I use default view (standard grid) and switch to custom control after - view selector and search box disappear. For me it looks like a bug.

cc: @HemantG 

@a33ik 

 

1) Thanks for reporting the issue. I am able to reproduce at my end

 

2) Our current stage is that the ViewSelector/QuickFind... as others, they need to go with the first rendered control before any 'ShowAs'.

 

For example, suppose the first rendered control is ControlA, then using 'ShowAs', we could switch to 'ControlB'. Then if 'ControlA' is not compatible with things like 'ViewSelector', then 'ControlB' won't show 'ViewSelector'

 

This is to prevent any confusion that suppose for the inititial view is

1) View 1 / Control A, then click 'ShowAs' to switch to Control B, then

2) View 1 / Control B, then use view selector to go to View 2

3) View 2/ Control B, then if we use 'ShowAs' to go back to 'ControlA', then

4) View 1/ControlA, or View 2/ControlA?

At this moment, as the ControlA could not see any view, it might have some confusion.

If we show View1, then the previous stage is View2

If we show View2, then at very initial stage, it is View1. should it be idempotent after these series of switchs?

 

In order to avoid any change, then we make it honor the first control's setting.

 

3) We do have a bug that our ReadonlyGrid/EditableGrid manifest does not claim they are compatible with quickFind/ViewSelector. Those are added by some hard-coded logic but its metadata does not claim it. If it switch to other controls, other controls will go with the ReadonlyGrid/EditableGrid setting so far.

We open a bug internally to update the metadata to make them compatible

 

 

 

 

Hi Scott, I have an existing PCF where I added the code below to display the command bar of the sub-grid where the PCF is attached.

<data-set name="dataset" display-name-key="Dataset" cds-data-set-options="displayCommandBar:true;displayViewSelector:true;displayquickfind:true">

It works but when I attached the PCF to a view on a dashboard, the command bar and view selector are still not visible. Am I missing anything? 

 

Thank you in advance for your reply.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,367)