Telerik Forums
UI for ASP.NET MVC Forum
3 answers
362 views
Is there a way to bind a TreeList to a local datasource like you can with the grid?

With the grid, you can do this: @(Html.Kendo().Grid(Model)

The TreeList doesn't seem to like that.

Konstantin Dikov
Telerik team
 answered on 30 Jul 2018
1 answer
1.3K+ views

Hello,

We used treelist which inside scrollable div  in our MVC project.  If we configured scrollable= false for treelist all column's width will mess up. If we used default setting (which is scrollable=true) the double scroll bar appeared which is not allowed in project. How to configured scroll bar only horizontally or vertically for Kendo UI treelist ?

Thanks

Preslav
Telerik team
 answered on 26 Jul 2018
3 answers
109 views

In the Editing example, (screenshot attached) if the user clicks on Add New Record, a new blank line appears at the top of the TreeList, therefore the new entry would be at the root.  How would I go about it, if I wanted to add someone under Buffy (using the sample data)?  I understand, I could have the user add a new row, then drag and drop the new value anywhere in the hierarchy, but I have a few issues with that.  First, I don't think it's a great user experience for the user to have to do that.  Secondly, and more importantly, we have business rules that don't allow people add a value to the root level.

 

I was hoping I could click on the row for Buffy, then click add and have the new row appear under Buffy's row.  Is this possible?

 

Thanks,

Mike

Viktor Tachev
Telerik team
 answered on 13 Jul 2018
5 answers
733 views
Hi, 
I'm having trouble managing the inline edit mode in my TreeList.
I would like to enable the inline edit mode (.Editable(e => e.Mode("inline"))) only on nodes without children, so I tought that, fired the "edit" event and checked for the presence of children, I could cancel it using preventDefault() but it's doing nothing.

I searched a lot but couldn't find anything helping me whit this issue.

Bonus question: is it possible, in inline mode, to enable the edit function only for one column?


Thanks a lot! 
Alessandro
Top achievements
Rank 1
 answered on 13 Jun 2018
1 answer
356 views

Hi,

I have a TreeList with several columns. One of them is displaying an image. The others just some short text.
The image column contains the url in it's model and I use a custom template to show the image. This is gonna work as expected:

columns.Add().Field(i => i.ImageUrl).Template("<img src=\"#: ImageUrl #\">")

 

But no I wand to edit this row and have a custom editor for this image column. At the end I wand to embedd DropZone to upload a new image. How can I assign a custom editor (any kind) instead of the default textbox which appears for basically every kind of data type?

I've seen that the column builder has a method called "Editor(string value)". But the API documentation of Kendo is as useless as ever. I don't understand why a enterprise grade component provider can survive with such bad quality. Nevertheless, is this maybe the way to go? If yes, how should I use this method? Because it's not the name of a kendo-template, editor template, javascript function nor html id.

Thank you. Best regards.

Alex Hajigeorgieva
Telerik team
 answered on 17 Apr 2018
3 answers
405 views

Hi,

I am using a treeview to load data and on edit of a row, i would want to display a dropwon to choose data, i tried below to get the dropdown, but this does not give me a dropdown, please advise if this is possible or how to achieve this.

columns.Add().Field(e => e.InActive).Editor("StatusType").Width(100) ;

below is a partial view i added under the EditorTemplate folder

@model CodedValues
@(Html.Kendo().DropDownListFor(m => m)
        .AutoBind(true)
        .DataTextField("DisplayText")
        .DataValueField("KeyText")
        .DataSource(dataSource =>
        {
            dataSource.Read(read => read.Action("GetTypes", "my"))
                    .ServerFiltering(true);
        })
)
@Html.ValidationMessageFor(m => m)

 

Thanks in advance.

Konstantin Dikov
Telerik team
 answered on 25 Jan 2018
4 answers
82 views

Hi,

I am trying to apply the functionality from Resize and Expand Grid

https://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Layout/resize-grid-when-the-window-is-resized

to the TreeList.

I have tried tree.Scrollable(true); as an equivalent for grid.Scrollable(scrollable => scrollable.Height("auto")); but it does not work. At least the classes on content are not the same.

Can this be achieved? How can I have resize and Expand TreeList to 100% Height?

Dan
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 06 Dec 2017
1 answer
415 views

Hello,

I want to hide the CreateChild command ont he third level of my nodes.
So if wonder if a way to get the node level of an element exists on databound event ?

Or maybe ther is a better way to accomplish it ?

I started the databound event like this:

function dataBound(treeview) {
    var node;
    var nodes = treeview.sender.dataSource.view();
 
    for (var i = 0; i < nodes.length; i++) {
        node = nodes[i];
    }
}

I don't want use the hasChildren attribut beacause in my model sometimes element at level 2 doesn't have children.    

Thank you in advance

Stefan
Telerik team
 answered on 08 Nov 2017
6 answers
672 views
Hi 
Please help me out. I am breaking my head to achieve the load on demand treelist in kendo. I have followed the instructions as per the url http://demos.telerik.com/aspnet-mvc/treelist/remote-data-binding. But nothing worked out. My scenario is like that I need to load the parent nodes when loading the page first. Then on clicking the parent node, need to fire a call to get the child nodes. For me, it load the parent nodes first, but I can't see the expand icon coming up for nodes having children. Just see the attached image. I don't know what I'm doing wrong. Attaching the view page code and also the controller methods. Please let me know what is the issue? Well appreciated, if you could share some code for sample other than the demo sample.
View code
----------------------
 <div>

                @(Html.Kendo().TreeList<TelerikMvcApp1.Models.AssetModel>()
                .Name("assetTreeList")
                .Columns(columns =>
                {
                    columns.Add().Field(a => a.AssetName).Width(70).Expandable(true);
                })
                .Sortable()
                .DataSource(dataSource => dataSource
                    .Read(read => read.Action("LoadTree", "Home"))
                    .ServerOperation(false)
                    .Model(m =>
                    {
                        m.Id(e => e.AssetId);
                        m.ParentId(e => e.ParentAssetId);
                        m.Field(e => e.AssetName);
                        m.Field(e => e.ParentAssetId);
                    })
                    )
                .Scrollable(true)
                .Height(540)
               //.Events(e => e
               ////.DataBound("onAssetTreeListDataBound")
               //// ////.Change("treelist_change")
               //)
                )

            </div>
Controller Methods
-------------------------------------------------
 public IEnumerable<AssetModel> GetAssetTreeListBasedOnPermissions()
        {
            try
            {
                List<AssetModel> list = new List<AssetModel>();
                list.Add(new AssetModel { AssetId = 1, ParentAssetId = null, AssetName = "asset1" });
                list.Add(new AssetModel { AssetId = 2, ParentAssetId = 1, AssetName = "asset2" });
                list.Add(new AssetModel { AssetId = 3, ParentAssetId = null, AssetName = "asset3" });
                list.Add(new AssetModel { AssetId = 4, ParentAssetId = 2, AssetName = "asset4" });

                IEnumerable<AssetModel> enumlist = list
                    .Select(x => new AssetModel
                    {
                        AssetId = x.AssetId,
                        ParentAssetId = x.ParentAssetId,
                        AssetName = x.AssetName
                    });
                return enumlist;

              
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        public JsonResult LoadTree([DataSourceRequest] DataSourceRequest request, int? id)
        {
            var result = GetAssetTreeListBasedOnPermissions().ToTreeDataSourceResult(request,
                e => e.AssetId,
                e => e.ParentAssetId,
                e => id.HasValue ? e.ParentAssetId == id : e.ParentAssetId == null,
                e=>e
            );

            return Json(result, JsonRequestBehavior.AllowGet);
        }
Model class
------------------------
 public class AssetModel
    {
        public long AssetId { get; set; }
        public long? ParentAssetId { get; set; }
        public string AssetName { get; set; }
        public bool HasChildren { get; set; }
    }
Thanks in advance
Binta Prasad
Tsvetina
Telerik team
 answered on 31 Oct 2017
3 answers
349 views

We have implemented in grid a conditional filter using 'filterMenuOpen' and 'filter' events of the grid. And it works.
Now we have a page where a hierarchy data needs to be display and must have the same look and feel as the grid, hence the conditional filtering. In order to do this we have modified the treelist in order to have the 'filterMenuOpen' and 'filter' events on tree adapting the code from grid. 
We also handled the filter open like in the thread http://www.telerik.com/forums/cascade-filter-using-ajax-binding

But we have found that setting the filter on treelist does not work in the same way as it does for grid:
1. We have a table with Id, MainField, SubField, ParentId => the data is displayed in the treelist correctly
(The SubField has to have the source dynamic based on the MainField selected)
2. Select a filter on MainField => the data is filtered correctly
3. Select a filter on SubField => The datasource of SubField it is correct based on the selected MainField filter value and the filter is done correctly
4. Change the MainField filter and select another value (we have to remove the SubField filter) =>
The TreeList displays changes multiple times and the last one is not the correct one (It displays the same data as the first filter at point 2)

Questions:

1. Is there a way to make the filter functionality work like in grid?

2. Is there a plan to soon release a new version to make the treelist have the same functionality as the grid? If not can we still hope there will be one :D

3. Is there a solution to implement the hierarchy in the grid?

 

PS: Because we are using MVC and should have the same filtering as the grid we had to attach to the framework the same functionality (as in grid) already supported by the filter (kendoFilterMenu) in treelist.

Stefan
Telerik team
 answered on 05 Sep 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?