Unplanned
Last Updated: 09 Mar 2023 11:16 by Danijela
Danijela
Created on: 07 Mar 2023 10:58
Category: UI for ASP.NET Core
Type: Feature Request
0
TreeList bind data to checkbox just like any other column

I am using TreeList for setting permissions. It seemed a perfect choice until I realized that state of ALL the checkboxes is set to either true or false.

I would like to be able to select checkbox based on the value of record i.e. to be able to save it's state in database, retrieve it, and batch update it.

I know that this behavior can be simulated / achieved by using javascript, but it would be so much better, easier and neater to have it data bound just like all the other columns.

For example, I have an organisational structure on the picture below. We can set permissions on any level. 

I imagine that the syntax could be something like:

@(Html.Kendo().TreeList<OrgStrukturaTree>()
    .Name("treeOrgRO")
    .Columns(columns =>
    {
        columns.Add().Selectable(true).Width("20px");
        columns.Add().Field(e => e.Opis).Width(250);
    })
    .Filterable(false)
    .Sortable(true)
    .DataSource(dataSource => dataSource
        .Read(read => read.Action("ObjektiTree_Read", "Admin"))
        .ServerOperation(false)
        .Model(m => {
            m.Id(f => f.Id);
            m.ParentId(f => f.ParentId);
            m.Expanded(true);
            m.Selected(f => f.Selected);
            m.Field(f => f.Opis);
        })
    )
)

I sincerely hope you would consider this update, as I cannot think of a scenario when I would use checkboxes that are all the same state.

Thank you in advance.

2 comments
Danijela
Posted on: 09 Mar 2023 11:16

Sorry, Expanded actually works. (I couldn't delete my previous comment.)

m.Expanded(f => f.Expand);
Danijela
Posted on: 09 Mar 2023 10:41

I would also like Expand to be driven by database as well.

For example, I would collapse the nod that has no selected children, otherwise I would expand it so that selections are visible.

So instead of having:

m.Expanded(true);

I would like something like this:

m.Expanded(f => f.Expand);