Grid column filter operators showing No Data Found

4 posts, 0 answers
  1. Will
    Will avatar
    6 posts
    Member since:
    Apr 2008

    Posted 30 Mar 2017 Link to this post

    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>

     

     

  2. Stefan
    Admin
    Stefan avatar
    3008 posts

    Posted 03 Apr 2017 Link to this post

    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 visualization (charts) and form elements.
  3. Anthony
    Anthony avatar
    1 posts
    Member since:
    Feb 2014

    Posted 04 Sep 2019 Link to this post

    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.
  4. Georgi
    Admin
    Georgi avatar
    685 posts

    Posted 06 Sep 2019 Link to this post

    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.
Back to Top