Getting the id from the grid column filter menu

3 posts, 1 answers
  1. Matt
    Matt avatar
    5 posts
    Member since:
    Nov 2015

    Posted 13 Jan 2016 Link to this post

    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. Answer
    Radoslav avatar
    1566 posts

    Posted 15 Jan 2016 Link to this post

    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.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Matt
    Matt avatar
    5 posts
    Member since:
    Nov 2015

    Posted 19 Jan 2016 in reply to Radoslav Link to this post

    Thanks Radoslav

    That helped us fix our issue.

Back to Top