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

Grid column filter operators showing No Data Found

3 Answers 646 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Will
Top achievements
Rank 1
Will asked on 30 Mar 2017, 03:32 PM

Grid column filter operator list shows No Data Found when I have a column with a ClientTemplate

columns.Bound(roomIndex => roomIndex.RoomBuilding)
            .Title("Building")
            .EditorTemplateName("BuildingSelect")
            .ClientTemplate("#=RoomBuilding.BuildingName#")

 

I attempted to fix the problem by adding an operator (below) but my list of filter operators is still empty and I don't understand why the above code doesn't work.

        columns.Bound(roomIndex => roomIndex.RoomBuilding)
            .Title("Building")
            .EditorTemplateName("BuildingSelect")
            .ClientTemplate("#=RoomBuilding.BuildingName#")
            .Filterable(filter => filter
                .Extra(false)
                .UI("buildingFilter")
                .Operators(operators => operators
                    .ForString(str => str.Clear().IsEqualTo("Is equal to"))
            ));

 

<script type="text/javascript">
    function buildingFilter(element) {
        element.kendoDropDownList({
            dataSource: {
                transport: {
                    read: "@Url.Action("GetSelectList", "Buildings")"
                },
            },
            dataTextField: "BuildingName",
            dataValueField: "BuildingId",
            optionLabel: "--Select Value--"
        });
    }
</script>

 

 

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 03 Apr 2017, 08:09 AM
Hello Will,

This is not a known issue and I was not able to reproduce it on my end.

Additionally, please advise why both the ClientTemplate and the EditorTemplateName are used together in the application?

Also, please have in mind that the built-in filter does not support filtering complex objects, which I can assume is RoomBuilding.

Could you please send us a runnable example demonstrating the issue, so I can investigate it and provide a suggestion best suited for it.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Anthony
Top achievements
Rank 1
answered on 05 Sep 2019, 01:17 AM
I ran into the same issue. The Operators command does not work when there is a ClientTemplate. It works when I remove ClientTemplate.

Regarding the question "why both the ClientTemplate and the EditorTemplateName are used together", the column is bound to an ID field and the EditorTemplate is a dropdownlist that displays the text but the value is an ID. The ClientTemplate displays the text when not in edit mode, otherwise it will display the ID value on the grid.
0
Georgi
Telerik team
answered on 06 Sep 2019, 01:10 PM
Hello Anthony,

If I understand correctly the model stores some key and you map it to a text which is displayed in the column.

Have in mind that this feature is provided out of the box by the Grid - foreign key column. Have you considered switching to a foreign key column?

Finally, if the field is a complex object and you would like to enable filtering, you will have to bind the column to a property of the object as the dataSource does not operations for complex objects. You can find a runnable sample which demonstrates the above approach below:



Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Will
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Anthony
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or