DropDownBox in Grid Cell Filter Behaving incorrectly

2 posts, 1 answers
  1. Noah
    Noah avatar
    25 posts
    Member since:
    Jan 2013

    Posted 10 Mar 2015 Link to this post

    I have grid with a column bound like this...

    cols.Bound(m => m.Location).Filterable(fl => fl.Cell(c => c.Template("locationFilter").Operator("equals").ShowOperators(false)));

    and some javascript..

    var locationList = [
                            {text: "Atlanta", value: "ATL"},
                            {text: "Houston", value: "HOU"},
    function locationFilter(container) {
                    dataTextField: "text",
                    dataValueField: "value",
                    optionLabel: { text: "-ALL-", value: "" },
                    dataSource: { data: locationList, },

    This seems to initialize correctly showing '-ALL-' with no filter applied.  But as soon as I select something in the dropdownlist it immediately changes the selection back to "-ALL-" and filters out all the items.

    However, if I change it to this and use strings for the data instead of objects, it lets me select items and applies the filters ok but the display isn't optimal...

    function locationFilter(container) {
                    optionLabel: "-ALL-",
                    dataSource: {data: ["ATL", "HOU"],},

    Am I doing something wrong when trying to use objects in the datasource for the custom filter, or is there a bug?
  2. Answer
    Alexander Popov
    Alexander Popov avatar
    1445 posts

    Posted 12 Mar 2015 Link to this post

    Hi Noah,

    This happens because the DropDownList's valuePrimitive option is not enabled. As a a result the applied filter is actually an object instead of string, for example - {text: "Atlanta", value: "ATL"}.
    Enabling the valuePrimitive option should get you the desired behavior.

    Alexander Popov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top