Is it possible to use rowRender with custom component but still retain original cell render functionality?

1 Answer 143 Views
Grid
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Vincent asked on 16 May 2022, 01:44 PM

I want to use the rowRender grid prop with a custom vue component to add additional logic per each row


In this example it's done with a Vue render function:

Vue Grid Component & Styling | Kendo UI for Vue Docs & Demos (telerik.com)

 

However for my use case I'm trying to use vee-validate's useForm() composable on each row for validation. This composable has to be ran inside a script setup thus requiring me to use a custom vue component for rowRender.

 

So is it possible to use rowRender with a custom component and still retain the automatic cell rendering like in the render function example?


So something like this (but working of course):

CustomRow.vue:

<template>
   <tr>
      <slot><!-- render cells here automatically--></slot>
   </tr>
</template>

1 Answer, 1 is accepted

Sort by
1
Accepted
Petar
Telerik team
answered on 17 May 2022, 09:15 AM

Hi Vincent,

If I am correctly understanding your scenario this StackBlitz project should help you achieve what you need. The example in the link implements the same scenario as the one you sent in your post but uses a slot template, instead of a render function. 

Let me know if the above example helps you achieve the targeted functionality in your project. 

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Vincent
Top achievements
Rank 3
Iron
Iron
Iron
commented on 17 May 2022, 09:30 AM

No I was looking more for automatic rendering of the cells instead of the manual rendering in your example.


I hoped it would've been possible with a special prop or slot or something (like the render function) and I could just render the cells automatically like this:

Ff2ma6 (forked) - StackBlitz
Petar
Telerik team
commented on 17 May 2022, 09:38 AM

Hi, Vincent.

Thank you for the additional details. I can confirm that there is no option for automatic rendering when using slot templates. When we use the rowRender property we have to manually define the template of the row. 

Let me know if I can help you with something else related to the current ticket.

Vincent
Top achievements
Rank 3
Iron
Iron
Iron
commented on 17 May 2022, 02:12 PM

Okay then, that settles it. I opted to manually render each cell because it was a requirement for my particular use case.

Thanks for answering my question
Petar
Telerik team
commented on 18 May 2022, 07:52 AM

You are welcome, Vincent. I am happy to hear that you managed to implement what you need.
Tags
Grid
Asked by
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Petar
Telerik team
Share this question
or