Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datagrid - Unselect child data grid #1705

Closed
devinbandara opened this issue Jan 14, 2021 · 22 comments
Closed

Datagrid - Unselect child data grid #1705

devinbandara opened this issue Jan 14, 2021 · 22 comments
Labels
Type: Bug 🐞 Something isn't working

Comments

@devinbandara
Copy link

Currently when you select a datagrid row that has a child grid, the child grid expands when you click on the parent row but if you click on the parent row again, you can not deselect the row and collapse all the child grid rows. The only way to collapse the child grid row is to click on another row.

Can you add a feature that collapses the Child Grid within a selected parent row when you click on the parent row?

@stsrki
Copy link
Collaborator

stsrki commented Jan 14, 2021

Just hold the CTRL key while clicking on a row. It's a standard way of unselecting the row and it is supported by DataGrid.

@paulosdfigueiredo
Copy link
Contributor

If you really want unselect on click you can just use a SelectedEntity like this in your component.

protected TItem SelectedEntity
{
	get => this.selectedEntity;

	// unselect if it's an entity already selected
	set => this.selectedEntity = (this.selectedEntity != null && this.selectedEntity == value) ? null : value;
}        

@devinbandara
Copy link
Author

Just hold the CTRL key while clicking on a row. It's a standard way of unselecting the row and it is supported by DataGrid.

This action unselects the parent grid but does not collapse the child grid. Child grid stays expanded

@stsrki
Copy link
Collaborator

stsrki commented Jan 15, 2021

Child grid is controlled by DetailRowTrigger handler

Example

DetailRowTrigger="@((item)=>item.Salaries?.Count > 0 && item.Id == selectedEmployee?.Id)"

@StephenOTT
Copy link

Just hold the CTRL key while clicking on a row. It's a standard way of unselecting the row and it is supported by DataGrid.

@stsrki does this still work? I am unable to reproduce in the demo.

@stsrki
Copy link
Collaborator

stsrki commented Jun 21, 2021

@StephenOTT It works, I have just tried the demo in Chrome and Firefox. What browser do you have?

@StephenOTT
Copy link

I am on mac and tried with https://bootstrapdemo.blazorise.com/tests/datagrid

Using CTRL plus click on a row (all options turned off on the grid) just produces the browsers context menu.

Tried with latest FF, Chrome, and Safari using OSX latest

@stsrki
Copy link
Collaborator

stsrki commented Jun 21, 2021

I have no idea how to reproduce it without mac...

@StephenOTT
Copy link

To confirm the functionality:

Screen Shot 2021-06-21 at 5 13 55 PM

If i were to CTRL+mouse left click Caro in row one, the Detail Row should collapse?

@stsrki
Copy link
Collaborator

stsrki commented Jun 21, 2021

Yes, it should collapse if it is opened. Or open if it is already collapsed. Basically toggle open states.

@StephenOTT
Copy link

StephenOTT commented Jun 21, 2021

Okay yup.. does not seem to work...

x-ref: #2500

@stsrki
Copy link
Collaborator

stsrki commented Jun 21, 2021

I can only asume on Mac ctrl key is not detected properly. Is it named diferently?

@stsrki
Copy link
Collaborator

stsrki commented Jun 22, 2021

@StephenOTT Any chance you could clone Blazorise and debug it on Mac? In file Blazorise.DataGrid._BaseDataGridRow there is a HandleSingleSelectClick method. eventArgs.CtrlKey should be true if everything is good.

@StephenOTT
Copy link

I think you are running into the OS X system wide CTRL+Click == Right Click. I do not think there is a way to disable it.

The Alt/Option key is usually used as a alternative and you can see it gets picked up:
Screen Shot 2021-06-22 at 10 10 53 AM

This is debug with Alt+Click. If i debug with CTRL+Click it does not trigger the breakpoint because the system context menu for the browser appears:

CTRL+Click does this and does not trigger the HandleClick method:
Screen Shot 2021-06-22 at 10 16 10 AM

@StephenOTT
Copy link

StephenOTT commented Jun 22, 2021

Similar scenarios: https://stackoverflow.com/questions/45438932/ho-do-i-capture-ctrl-click-on-macos-with-d3js

Using the "Command" button: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey

Command+Click on a row currently triggers the HandleClick method, BUT there is no property (MetaKey) to identify that it was pressed.

@stsrki
Copy link
Collaborator

stsrki commented Jun 22, 2021

How it is usually done on Mac? The select and deselect of items..

@StephenOTT
Copy link

I have seen a mix of usage. But If you follow close to how windows works: example: CTRL+W is close tab in a browser. The Mac equiv is Command+W (MetaKey+W)

@GilShalit
Copy link

I can confirm this is working fine on Windows

@David-Moreira
Copy link
Contributor

@StephenOTT I honestly don't know MAC very well.. But do you not have this corresponding key?
Not the Command, but the Control.
image

@JanVargovsky
Copy link

We have custom logic for (multi)selecting rows in DataGrid and the args.MouseEventArgs.CtrlKey doesn't work, meaning it's false when control is pressed on MAC.

@David-Moreira
Copy link
Contributor

We need to do some digging...any developer around who knows how this is usually handled with a MAC?

Even with js you'd have the same problem right?

@stsrki stsrki added the Type: Bug 🐞 Something isn't working label Dec 6, 2021
@stsrki stsrki added this to the 0.9.5 Support milestone Dec 6, 2021
@David-Moreira
Copy link
Contributor

Hello guys,
We are still working on getting the tools to troubleshoot this Issue.
In the meantime it would be great if you could help us. If you own a MAC, could you please visit our demo at :
https://megabit.github.io/DemoMetaKey/

Press the Mac's Ctrl Key while clicking the button and send us the log?
Thanks!

@stsrki stsrki added this to Support Aug 3, 2024
@stsrki stsrki moved this to ✔ Done in Support Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐞 Something isn't working
Projects
Archived in project
Development

No branches or pull requests

7 participants