Row hovered should call an event so I can show something at the table.
There is no guarantee in receiving a response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeNG PRO Support where support is provided within 4 business hours
I'm submitting a ... (check one with "x")
[ ] bug report => Search github for a similar issue or PR before submitting
[X] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior The behavior wanted is not supported.
What is the motivation / use case for changing the behavior? The motivation is that I need to hover throught a ROW, and I need that when the HOVER happens two buttons should appear at the end of the table.
-
Angular version: 5.0.0
-
PrimeNG version: 4.3.0
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] All of them.
-
Node (for AoT issues):
node --version= v6.10.0
What's wrong with only using CSS to do that? Here's a quick example.
The problem is that I'm using the p-dataTable in multiple places, if I override the CSS either using /deep/ or placing into a global CSS, all my tables will act accordingly, but I want to use it in just one place. Your example indeed works fine, but it's not what I'm looking for.
I don't think it's necessary to overwrite any CSS. You can add your own only to a specific dataTable component. By specifying style or styleClass properties on a dataTable you can add either inline CSS or a custom class, which you can use in your CSS style sheet. Take a look at the Properties table in the documentation.
@dzhavat I have similar requirement, to display buttons in another column on row hover. Its working via CSS. But when I am hovering on that column (where display buttons are present) its not responding to CSS and is remaining AS IS with plain white background To display buttons, I used Visibility property instead of display property (as display caused some misalignments). Is there anyway to fix my case ?
Well, you do actually, because using styleClass you'll be giving the p-column attribute the class you chose, meaning that the


And the style is not setting the class in any element that I choose. So I'm having a bad time because of this. And since (mouseover) or (mouseenter) doesn't work on the p-dataTable or p-column you can see where I'm getting at. And using tr:hover or anything like that at the local scss doesn't work.
If any of you have any other suggestion that I should try, please, do suggest.
I was able to use the rowStyleClass and then use a certain style at every row. And then using what @dzhavat showed at codepen I was able to to in part what I wanted. Still, definitely not the best way of using it.
@Galiza Why don't you put a class on the dataTable with styleClass and then use that class in your CSS.
Something like:
.myDataTable tr button {
display: none;
}
.myDataTable tr:hover button {
display: inline-block;
}
@dzhavat Because when you place the styleClass on the dataTable, the tag that gets the css class is the
@Galiza I've created a simple a Plunkr example showing a way to do what you need (at least that's the way I understood it from your description).
The important thing to note is encapsulation: ViewEncapsulation.None inside the app/app.component.ts file. Removing this line will make the button not show on hover.
The reason this is working is because encapsulation: ViewEncapsulation.None disables the style encapsulation, which Angular applies on every component.
@dzhavat Well, that's some nice example there, and now I get what you meant. Thank you very much!
We rather not provide a built-in solution as it will break the performance due to constant change detection of Angular on rowHover.