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

Getting the id from the grid column filter menu

2 Answers 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 14 Jan 2016, 03:09 AM

If I set up a multi:true filterable column with a datasource on the grid, the datasource returns an array of objects:

[{ code: "A", description: "DescriptionA"}, {code: "B", description: "DescriptionB"}]

If I set filterable:

<p>{</p><p>multi: true,</p><p>field: "description"</p><p>}</p>
The filter menu displays checkboxes for all the descriptions in the datasource.

But when I select a few and click filter, how can I get it to create the filter object using code rather than description?

2 Answers, 1 is accepted

Sort by
0
Accepted
Radoslav
Telerik team
answered on 15 Jan 2016, 09:35 AM
Hello Matt,

To achieve the desired functionality you can use following approach:
Bind the column to the code field and use template which shows the description field:
{ field: "code", template: "<strong>#: description# </strong>",

Then for the filtering you can use also the template to show the descriptions next to the checkboxes:
{ field: "code", template: "<strong>#: description # </strong>", filterable: { multi: true, search: true, itemTemplate: function(e) {
                    return "<label><input type='checkbox' name='" + e.field + "' value='#= data. code #'/>#= data.description #</label><br>"
                } } },

On the following link I created a small example which demonstrates this approach. Please check it out and let me know if it helps you.

Looking forward for your reply.

Regards,
Radoslav
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Matt
Top achievements
Rank 1
answered on 20 Jan 2016, 03:05 AM

Thanks Radoslav

That helped us fix our issue.

Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Matt
Top achievements
Rank 1
Share this question
or