rowRender - prevent from rendering the row

1 Answer 132 Views
Data Query Grid
Janki
Top achievements
Rank 4
Bronze
Iron
Iron
Janki asked on 18 Feb 2022, 07:47 PM | edited on 18 Feb 2022, 07:49 PM

I'm trying to prevent headerGroup rows from rendering based on certain conditions.

When I try to utilize rowRender for this purpose, I can't make it work because it controls only the render of cells within the row. Returning null and <td></td> don't work (the row still renders but with nothing in it or with empty cells).

Is there any way I can target the row instead of the cells? I would even take being able to simply add a class to the row to hide it from the user with CSS.

I can't target the row with the row:empty CSS selector because the groupHeader rows come with k-group-cell cells already rendered before the renderRow even starts rendering custom cells.

Did I overlook anything that Kendo offers? Thank you!

1 Answer, 1 is accepted

Sort by
1
Accepted
Konstantin Dikov
Telerik team
answered on 21 Feb 2022, 06:36 AM

Hello Janki,

For preventing the rendering of entire row you should use the "rowRender" of the Grid and check if the rowType is "groupHeader" and if so, based on your condition, you can return a React.Fragment:

Note that the rowRender expects a "TR" element to be returned and not "TD".

Hope this helps.

 

Regards,
Konstantin Dikov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Data Query Grid
Asked by
Janki
Top achievements
Rank 4
Bronze
Iron
Iron
Answers by
Konstantin Dikov
Telerik team
Share this question
or