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

DDL Value not mapped to Filter in editor template

4 Answers 44 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Headygains
Top achievements
Rank 1
Veteran
Headygains asked on 25 Jan 2021, 06:56 PM

Working on integrating a Kendo.DropDownList() into a Kendo.Filter object.

It currently works in everyway, other than actually supplying the selected value from the DDL into the datasource / grid binding.

How do I map the Value selected in the Filter Editor Template to the datasource / grid binding. I just need to pass the selected words to be used in the code behind query.

Current Implementation (DDL):

@(Html.Kendo().Filter<KitValidationDtoModel>()
    .Name("filter")
    .ApplyButton()
    .ExpressionPreview()
    .MainLogic(FilterCompositionLogicalOperator.And)
    .Fields(f =>
    {
        f.Add(p => p.OrderId).Label("Davidson Order ID");
        f.Add(p => p.EdiOrderId).Label("EDI Order ID");
        f.Add(p => p.Rfid).Label("RFID Tracker");
        f.Add(p => p.Assy).Label("ASSY");
        f.Add(p => p.Control).Label("Control Point").EditorTemplateId("controlTemplate");
        f.Add(p => p.Ei).Label("End Item");
        f.Add(p => p.Ship).Label("Ship");
    })
    .FilterExpression(f =>
    {
        f.Add(p => p.Control).IsEqualTo("");
        f.Add(p => p.Ship).Contains("");
    })
    .DataSource("dataSource1"))

 

<script type="text/x-kendo-template" id="controlTemplate">
    @(Html.Kendo().DropDownList()
                  .Name("control_filter_dll")
                  .OptionLabel("Select Control Point...")
                  .DataTextField("Control")
                  .DataValueField("Control")
        .DataSource(source =>
        {
            source.Read(read =>
            {
                read.Action("GetControlPoints", "CustomOrder");
            });
        }).Events(e => e.Change("onControlChange")).ToClientTemplate())
</script>

4 Answers, 1 is accepted

Sort by
0
Accepted
Patrick | Senior Technical Support Engineer
Telerik team
answered on 27 Jan 2021, 03:44 PM

Hi Dalton,

One approach you can take to adding a template to a Kendo UI Filter is using the same approach used in this Kendo UI Filter Live Demo.  For example:

@(Html.Kendo().Filter<KitValidationDtoModel>()
    .Name("filter")
    .ApplyButton()
    .ExpressionPreview()
    .MainLogic(FilterCompositionLogicalOperator.And)
    .Fields(f =>
    {
        f.Add(p => p.OrderId).Label("Davidson Order ID");
        f.Add(p => p.EdiOrderId).Label("EDI Order ID");
        f.Add(p => p.Rfid).Label("RFID Tracker");
        f.Add(p => p.Assy).Label("ASSY");
        f.Add(p => p.Control).Label("Control Point").EditorTemplateHandler("controlTemplate");
        f.Add(p => p.Ei).Label("End Item");
        f.Add(p => p.Ship).Label("Ship");
    })
    .FilterExpression(f =>
    {
        f.Add(p => p.Control).IsEqualTo("");
        f.Add(p => p.Ship).Contains("");
    })
    .DataSource("dataSource1"))

<script>
    function controlTemplate(container, options) {
        $('<input data-bind="value: value" name="' + options.field + '"/>')
            .appendTo(container)
            .kendoDropDownList({
                optionLabel: "Select Control Point...",
                dataTextField: "Control",
                dataValueField: "Control",
                dataSource: {
                    transport: {
                        read: "/CustomOrder/GetControlPoints"
                    }
                },
                change: onControlChange
            });
    }
</script>

Please take a look at the live demo and let me know if you have any questions regarding the implementation.

Regards,
Patrick
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Patrick | Senior Technical Support Engineer
Telerik team
answered on 28 Jan 2021, 02:35 PM

Hello Dalton,

Just wanted to followup with you: I have created a feature request on with a vote on your behalf asking for server editor templates to be accessible for the Kendo UI Filter.  Please feel free to add any comments and follow it for any updates.  

Regards,
Patrick
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Headygains
Top achievements
Rank 1
Veteran
answered on 29 Jan 2021, 03:48 PM

Hi Patrick,

Thanks for looking out, using server side templates has become our internal standard so I was trying real hard to get it working with that implementation (some of our devs just don't js well for some reason). But I'll knock out the implementation in js, thanks for your time.

0
Headygains
Top achievements
Rank 1
Veteran
answered on 29 Jan 2021, 03:57 PM
[quote]Patrick said:

Hi Dalton,

One approach you can take to adding a template to a Kendo UI Filter is using the same approach used in this Kendo UI Filter Live Demo.  For example:

 

@(Html.Kendo().Filter<KitValidationDtoModel>()
    .Name("filter")
    .ApplyButton()
    .ExpressionPreview()
    .MainLogic(FilterCompositionLogicalOperator.And)
    .Fields(f =>
    {
        f.Add(p => p.OrderId).Label("Davidson Order ID");
        f.Add(p => p.EdiOrderId).Label("EDI Order ID");
        f.Add(p => p.Rfid).Label("RFID Tracker");
        f.Add(p => p.Assy).Label("ASSY");
        f.Add(p => p.Control).Label("Control Point").EditorTemplateHandler("controlTemplate");
        f.Add(p => p.Ei).Label("End Item");
        f.Add(p => p.Ship).Label("Ship");
    })
    .FilterExpression(f =>
    {
        f.Add(p => p.Control).IsEqualTo("");
        f.Add(p => p.Ship).Contains("");
    })
    .DataSource("dataSource1"))

<script>
    function controlTemplate(container, options) {
        $('<input data-bind="value: value" name="' + options.field + '"/>')
            .appendTo(container)
            .kendoDropDownList({
                optionLabel: "Select Control Point...",
                dataTextField: "Control",
                dataValueField: "Control",
                dataSource: {
                    transport: {
                        read: "/CustomOrder/GetControlPoints"
                    }
                },
                change: onControlChange
            });
    }
</script>

 

Please take a look at the live demo and let me know if you have any questions regarding the implementation.

Regards,
Patrick
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

[/quote]

 

Flawless thank you.

Tags
Filter
Asked by
Headygains
Top achievements
Rank 1
Veteran
Answers by
Patrick | Senior Technical Support Engineer
Telerik team
Headygains
Top achievements
Rank 1
Veteran
Share this question
or