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

How to use a custom row template when mouse click selection is enabled #437

Closed
SergeyAlexeev opened this issue Oct 24, 2017 · 15 comments
Closed
Labels
Grid The DevExtreme Reactive Grid component question

Comments

@SergeyAlexeev
Copy link
Contributor

According to the documentation, if you are using the selectByRowClick or highlightSelected property, the tableRowTemplate property is ignored.

Currently, there is no documented way to implement a custom table row template in this case. Yet, you can use our internal templating mechanism to achieve such a functionality.

This demo shows how to do this. Please take a look at the comments given in the code.

@dapozdnyakov
Copy link

Hi! How to use this mechanism now in beta.2, when TemplateRenderer has been removed?

@SergeyAlexeev
Copy link
Contributor Author

Hi,
Please refer to the updated demo.

@dapozdnyakov
Copy link

@SergeyAlexeev Thank you!

@filippoitaliano
Copy link

filippoitaliano commented Sep 27, 2018

@SergeyAlexeev the way described in the updated demo works perfectly but I have a further problem: the default summary row doesn't work anymore. The grid fails render with this console error:

TypeError: getRowLevelKey is not a function

I guess I missed to pass some params to the custom row, but I can't figure out which they can be.

Thanks in advance.

@SergeyAlexeev
Copy link
Contributor Author

@filippoitaliano I've added a summary row to the example. It works fine.

@filippoitaliano
Copy link

filippoitaliano commented Sep 27, 2018

Ok, You're right. It works. I was passing down the wrong selection property because I was accidentally overwriting it with my component state...

@slavavasylencko
Copy link

@SergeyAlexeev How can I add hover, like this https://codesandbox.io/s/rylk1x324o in table and highlight selection plugin with enabled TableSelection Plugin?

@lin-zy1229
Copy link

lin-zy1229 commented Jan 19, 2019

Hi,
Please refer to the updated demo.

@SergeyAlexeev
It doesn't work for dxgrid/core 1.10.0, only works for 1.7.2.

image

image

Please update for latest version of dxgrid, thanks.

@msteinmn
Copy link

msteinmn commented Jan 19, 2019

@SergeyAlexeev @lin-zy1229 Are we talking about a workaround here for a bug that has not yet been fixed, or is this really the way it is supposed to be. I have not been able yet to get this to work with 1.10.0 and material-ui. Workarounds are great, but wait, are they really?

@lin-zy1229
Copy link

lin-zy1229 commented Jan 26, 2019

@SergeyAlexeev,
If I do <TableSelection selectByRowClick rowComponent={Row} />, instead of <Table rowComponent={Row} />, it works in latest version , (1.10.0)

However, RowStyle doesn't work.

Any way to get done this?

@msteinmn
Copy link

@lin-zy1229 Awesome, that worked.

@sentient-drone
Copy link

Type interface for <TableSelection selectByRowClick rowComponent={Row} /> has not been updated as of 1.10.3. And typescript errors that rowComponent does not exist on TableSelection

@SergeyAlexeev
Copy link
Contributor Author

SergeyAlexeev commented Mar 11, 2019

Hi,

And typescript errors that rowComponent does not exist on TableSelection

As you can see in our documentation, the TableSelection plugin doesn't contain a public rowComponent property.

I've updated the previously provided example to v.1.10.3 as well:

BS3 - https://stackblitz.com/edit/react-rxlvns?file=index.js
BS4 - https://stackblitz.com/edit/react-fk2ocn?file=index.js
MUI - https://stackblitz.com/edit/react-wagpnw?file=index.js

@churkin churkin added the Grid The DevExtreme Reactive Grid component label Jun 7, 2019
@churkin churkin closed this as completed Jun 7, 2019
@lock
Copy link

lock bot commented Jun 17, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 17, 2019
@LazyLahtak
Copy link
Contributor

LazyLahtak commented Jun 24, 2019

Hi all.
Let me explain what happens.
When you use the TableSelection with highlightRow or selectByRowClick properties, TableSelection overrides rowComponent from Table on its own.
https://devexpress.github.io/devextreme-reactive/react/grid/docs/reference/table-selection/#properties
You can use cellComponent instead of rowComponent in Table to process the onClick event (see this example).
You can also define rowComponent in TableSelection. However, it's an undocumented approach. If you want to use it with the selectByRowClick option, add the onToggle() call inside the onClick handler like in this example.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Grid The DevExtreme Reactive Grid component question
Projects
None yet
Development

No branches or pull requests

10 participants