Issue with Grid custom filterCell

1 Answer 23 Views
Grid
Adarsha
Top achievements
Rank 1
Adarsha asked on 19 Feb 2025, 03:22 PM

Hello all,

Facing some issue with rendering filterCell with a custom component.  This was working fine with Vue 2, and seems broken after we upgraded our application to Vue 3 and latest Kendo UI.

https://stackblitz.com/edit/dwpfqucx?file=src%2Fmain.vue%3AL18

Requesting for help, as we are stuck upgrading to latest Kendo UI

Adarsha
Top achievements
Rank 1
commented on 21 Feb 2025, 02:41 PM

@Vessy, @Filip Requesting for help

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 24 Feb 2025, 03:20 PM

Hello, Adarsha,

You can see a sample demonstrating how to implement a custom filter cell in the Grid in the following section of our documentation:

Basically, moving the defined custom filterCell to a slot template inside the Grid allowed me to run the provided by you setup successfully. You can access the runnable version below:

Regards,
Vessy
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Adarsha
Top achievements
Rank 1
commented on 25 Feb 2025, 02:04 PM | edited

Hello Vessy,

Thank you very much for your suggestion. However, since in our application we wrap Grid with one more component and reuse the wrapper across our application. So your suggested solution was not working. I explored the option of Render Function to render the filter cell and it is working fine now.

Solution below, if anyone else facing same issue

Replace below


checkBoxAllCell = {

..... data() {},

template: ``, ..... }

export default { ... data() { return { ... columns = [ { field: 'isActive', filterCell: checkBoxAllcell, ... } ], ... } } }

with

import { markRaw, h } from 'vue';

export default {
    ...,
    setup() {
        function renderCheckBoxAllCell() {
            return h('div', h(markRaw(checkBoxAllCell)));
        }
    },
    data() {
        return {
            columns = [
                {
                    field: 'isActive',
                    filterCell: this.renderCheckBoxAllCell,
                    ...
                }
            ],
        }
    }
}

Vessy
Telerik team
commented on 25 Feb 2025, 03:20 PM

Thanks a lot for the update, Adarsha, I am glad you have found a solution which is applicable to your scenario!
Tags
Grid
Asked by
Adarsha
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or