Unplanned
Last Updated: 06 Apr 2023 09:05 by ADMIN
Richard
Created on: 27 Mar 2023 07:37
Category: ChipList
Type: Feature Request
1
ChipList with remote data binding
Is it possible to implement an option for binding the ChipList to remote data?
2 comments
ADMIN
Mihaela
Posted on: 06 Apr 2023 09:05

Hello Richard,

Thank you for sharing your solution.

Indeed, you can set the ChipList items based on a Model collection that is available in the View:

@model UserViewModel

@(Html.Kendo().ChipList()
    .Name("Passages")
    ...
    .Items(item =>
    {
        foreach (ChipListDemo.Models.MyModel i in Model.MyList) //Ensure that the name of the variable in the loop is not "item" since "item" is used in the Items() configuration
        {
            item.Add().Label(i.Title + ' ' + i.SuBtitle);
        }
    })
)

Regards, Mihaela 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/.

Richard
Posted on: 31 Mar 2023 02:55

It is possible to bind to remote data, but indirectly

@(Html.Kendo().ChipList()
    .Name("Passages")
    .Selectable(ChipListSelectableMode.Single)
    .ItemSize(ComponentSize.Large)
    .Rounded(Rounded.None)
    .FillMode(ChipFillMode.Solid)
    .HtmlAttributes(new { @class = "btn-success" })
    .Items(item =>
    {
        foreach (MyModel item in Model.MyList.OrderBy(p => p.SortOrder).ToList())
        {
            item.Add().Label(item.Title + ' ' + item.SuBtitle);
        }
    })
    .Events(e => e.Select("onSelect_MyItem"))
)