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

DropDownBox in Grid Cell Filter Behaving incorrectly

1 Answer 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Noah
Top achievements
Rank 2
Iron
Iron
Iron
Noah asked on 10 Mar 2015, 02:56 PM
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) {
            container.element.kendoDropDownList({
                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) {
            container.element.kendoDropDownList({
                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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 12 Mar 2015, 10:05 AM
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.

Regards,
Alexander Popov
Telerik
 

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.

 
Tags
Grid
Asked by
Noah
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Alexander Popov
Telerik team
Share this question
or