This is a migrated thread and some comments may be shown as answers.

Kendo Grid Filter on a dynamic column

1 Answer 554 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 13 May 2013, 12:30 PM
I am working on a Kendo Grid which has a Status column that is an aggregate of statuses of several other columns. I track the individual statuses as integer values and the aggregate column should show the least of the statuses. Now, using template, I am able to render the text for the Status column fine, however, the problem is that I want this column to be filterable. This is not working as the value is calculated.

In DataSource, this is how I have declared the custom field,

    schema: {
        model: {
            Status: function () {
                return helper.GetStatus(this.EntriesStatus);
            }
        }
    }

This is how I used it in the Column definition,

    {
        field: "Status",
        title: "Status",
        width: "100px",
        filterable: true,
        template: kendo.template("#if (HasError) {# <strong class='clrRed' > \#= Status() #\ </strong> #} else { # \#= Status() #\ #} #"),
        hidden: false,
        menu: false
    }

Could anyone point out where I am going wrong or a more efficient way out?

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 15 May 2013, 08:48 AM
Hello Ravi,

The dataSource does not support calculated fields. The closest possible solution which I can suggest you is to use the parse method to transform/calculate the data. In this way you would be able to  specify the field type which is essential for filtering functionality.
Please check this sample: http://jsbin.com/aqaliy/2/edit

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Ravi
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or