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

[Solved] Templated Column List Filter

4 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Coty
Top achievements
Rank 1
Coty asked on 30 Jan 2015, 06:03 PM
Is it possible to filter a templated column that uses a function to iterate over a sub-class?

I have a grid that has the following column:
{
         field: 'agenda',
         template: kendo.template($("#agendas-template").html()),
         title: "Agendas",
         filterable: true,
         sortable: false,
         groupable: false
}

The Template function/script that is used to display the data:
<script id="agendas-template" type="text/x-kendo-tmpl">
           # $.each(agenda, function(data) { if (typeof this.Name !== "undefined") {#
             <span><a href="/#: this.URLBase #/agenda/#: this.Id #">#: this.Name #</a></span>
        # } }); #
</script>

The above functions display a list of links within one grid cell, because each meeting can have multiple Agendas.  Now I would like to be able to filter on the Agenda Name.  "this.Name" variable above.

Is this possible?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 03 Feb 2015, 02:35 PM
Hi Coty,

This can be done by using the nested property in the column's field option. For example: 
{
         field: 'agenda.Name',
         template: kendo.template($("#agendas-template").html()),
         title: "Agendas",
         filterable: true,
         sortable: false,
         groupable: false
}


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Coty
Top achievements
Rank 1
answered on 03 Feb 2015, 03:00 PM
Thanks for the response Alexander, however this isn't working for me.  It may be due to the fact that "agenda" is an IEnumerable list of Objects (not a single object).  agenda's type is IEnumerable<Agenda>.  So the property "agenda.Name" doesn't really exist it would be more like agenda[0].Name.

Is that possible?

Thanks,

Coty
0
Alexander Popov
Telerik team
answered on 05 Feb 2015, 10:19 AM
Hello Coty,

I apologize for this misunderstanding. I am afraid filtering by columns bound to collections is not supported.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Coty
Top achievements
Rank 1
answered on 05 Feb 2015, 12:45 PM
Ok, thanks for the response, luckily it isn't a game changer.  I assume a work around could be a concatenated (hidden) field of all the names combined that is done in the datasource and then only allow the "contains" filter to run on that column.  Not sure I want to do that yet or not though.

It would be a nice capability to add to the grid though, I can see this functionality being used quite often.

Thanks,

Coty
Tags
Grid
Asked by
Coty
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Coty
Top achievements
Rank 1
Share this question
or