Telerik Forums
UI for ASP.NET MVC Forum
1 answer
30 views

Hello,

I have this Kendo DropDownTree control:

<kendo-dropdowntree name="ddtNamespaces" datavaluefield="Value" filter="FilterType.Contains" datatextfield="Text" style="width: 100%;" 
                                                        check-all="true" 
                                                        on-change="onNamespaceChange" 
                                                        on-close="onNamespaceClose"
                                                        on->
                                        <hierarchical-datasource>
                                            <transport>
                                                <read url="@Url.Action("GetNamespaceListFromATAsync", "AI")" />
                                            </transport>
                                            <schema type="json">
                                                <hierarchical-model id="Id"></hierarchical-model>
                                            </schema>
                                        </hierarchical-datasource>
                                        <checkboxes enabled="true" />
                                    </kendo-dropdowntree>

I should send an ajax call after control change. When the user normally select a node it's working fine, but when the user clicks on 'All Items' node then the change event will be fired the combo-items-count times. So if I have 100 items in the combo, after click on 'All Items' the change event will be fired 100 times. This is not good for me, I would like send only one ajax call when 'All Items' item is selected.

I try a workaround to use the close event, and send the ajax call after closing the popup, but the close event is firing before all change event is finished so this not works.

Do you have any other idea to solve this? Thank you!

Anton Mironov
Telerik team
 answered on 19 Jan 2024
1 answer
99 views

Is there anyway to use the DropDownTree without it having to make so many requests.

It looks like it is essentially building the tree one request at a time for each item inside it. This is ridiculously inefficient.

Why can't it be passed a single data structure in a request to build itself, after all a dropdownlist,  combobox even a grid can be built with a single request for the IList<data> to databind. 

There is little to no documentation on the DropDownTree control which is disappointing.

For a Data structure like this, it makes 6 request which makes no sense.

  • Item 1
    • Item 1A (parent=1)
    • Item 1B (parent=1)
  • Item 2
    • Item 2A (parent =2)
  • Item 3

 

Could someone at telerik please provide an example of how to create such a data structure that can be passed to the DropDownTree in one request to allow it to render this. Currently this control is not very usable if it needs one request per item.

A treeview will load all it's data with a single request that returns an

var data = (IList<DataModels>)object .ToTreeDataSourceResult(request, e => e.ID, e => e.Parent_ID, e => e);

Does the DropDownTree not have something similar to a TreeDataSource? Why can't it use the same TreeDataSourceResult Object?

Ivan Danchev
Telerik team
 answered on 20 Sep 2022
1 answer
263 views
I have this inside my grid popup editor view:

@model App.UI.Web.Models.SuitViewModel

 

@(Html.Kendo().DropDownTreeFor(x => x.subjectid) .Name("subjectsDDT") .HtmlAttributes(new { style = "width: 500px;" }) .DataSource(ds => ds.Read("ReadDropDownTreeSubjects", "BaseDirectory") ) .Placeholder("Select subject...") .Filter("contains") .DataTextField("name") .DataValueField("id") .ValuePrimitive(true) .ClearButton(false) .Events(ev => ev.Select("watch")) )


The subjectid property of SuitViewModel view model must be equal to the id of the item selected in the dropdowntree but i always receive 0 in my controller. Where is the problem here?
Eyup
Telerik team
 answered on 17 Jan 2022
1 answer
166 views

Hi,

I have one requirement need to implement dropdown tree in kendo ui grid using mvc

 

can any one provide sample code

 

thanks

Anton Mironov
Telerik team
 answered on 05 Oct 2021
1 answer
524 views

I have a DropDownList and users are annoyed that whilst the data is loaded it says "No data found." when in fact, the data hasn't been loaded yet - I found this config item:

https://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist/configuration/messages.nodata

How do I make one message appear whilst the data source is loading, and another message once the data has loaded (and in fact, there was no data found)

Ivan Danchev
Telerik team
 answered on 02 Sep 2021
1 answer
622 views

Hi,

I am trying to use the same Dropdownlist in a parent grid, and its hierarchal/child grid. This Dropdownlist was written in jQuery and is kept inside the Shared/EditorTemplates folder and works as expected for the parent grid. However, when I apply it to columns on the child grid, it does not appear. It ignores the template and prompts me for an input like usual for inline editing instead of displaying the dropdownlist options.

Is it possible to use the same EditorTemplate inside of a hierarchy grid?

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 25 May 2021
12 answers
254 views

While selecting an item from the dropdowntree control, items without children shows-up properly but those with child items don't have labels, including the child items. The <span class='k-in'> is empty, it is direct-child of <div class='k-bot'> which is under the <li role='treeitem'>.

I followed this example but omitted the second mapping because from the root parents to the children, they share the same structure. IEnumerable of my "TreeItem" class:

public class TreeItem<T>{

public T Item {get;set;}

public IEnumerable<TreeItem<T>> Children {get;set;}

public bool HasChildren {

get {

return this.Children != null && this.Children.Coun() > 0;

}

}

}

 

And here's how I configured the binding part:

@(Html.Kendo().DropDownTree()

.Name("Categories")

.BindTo(Model.CategoriesList, mapping => {

mapping.For<TreeItem<Category>>(binding => binding

.Children(c => c.Children)

.ItemDataBound((item, categ) => {

item.Expanded = true;

item.HasChildren = categ.HasChildren;

item.Id = categ.Item.Id;

item.Text = categ.Item.Name;

item.Value = categ.Item.Id.ToString();

})

)

})

.LoadOnDemand(false)

)

the Model.CategoriesList is IEnumerable<TreeItem<Category>> which makes it the same structure as the Children of the TreeItem<Category> in here, if it matters.

Petar
Telerik team
 answered on 22 Dec 2020
8 answers
2.5K+ views

Hey,

So i have a very simple form 2 controls on it,

1 DropdownList

1 DropDownTree

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        @Html.Kendo().DropDownListFor(a => a.BranchId).OptionLabel("Select Branch").DataTextField("Text").DataValueField("Value").BindTo(Model.BranchList).HtmlAttributes(new { @class = "ff_required ff_control", @required = "required" })
    </div>
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <label class="ff_label">Select a parent category (optional)  <span class="ParentCategoryTip"><img src="~/Images/icons/help.png" /></span></label>
    </div>
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
 
    @(Html.Kendo().DropDownTreeFor(a => a.ParentCategoryId)
                                        .DataTextField("Name")
                                        .DataValueField("id")
                                        .Placeholder("Select Category")
                                        .HtmlAttributes(new { style = "width: 100%" })
                                            .Events(events => events
                                            .Change("DropdownTreeChange"))
    )

 

By default when the page loads i do not want to DropdownTree to bind to anything, it must be blank. Only once a selection is made from the BranchId DropDownList then i want the DropDownTree to be populated by passing the BranchId to the action method.

Here is what i have so far

$("#BranchId").on("change", function () {
 
        var tree = $("#ParentCategoryId").data("kendoDropDownTree");
        var val = tree.value();
 
 
        tree.refresh({
            url: "/Setting/GetCategorylist",
            data: {
                Id: val,
                BranchId: $("#BranchId").val()
            }
        });
    });

 

[HttpGet]
       //public async Task<ActionResult> GetCategorylist([DataSourceRequest] DataSourceRequest request, int BranchId)
       public async Task<ActionResult> GetCategorylist(int? Id, int BranchId)
       {
           var Result = await new _GetCategoryTreeList(new FF_ErrorLogger()).GetIdAsync(null,BranchId);
           return Json(Result, JsonRequestBehavior.AllowGet);
       }

 

i cannot get the DropDownTree to rebind its data.

 

Dimitar
Telerik team
 answered on 04 Mar 2020
2 answers
82 views

I don't see where Client Filtering must have LoadOnDemand set to false, but I am guessing it would, correct?

Or does it simply filter on what has been sent down to the client?

I mean how could you search on something not yet loaded?

Martin
Telerik team
 answered on 04 Dec 2019
6 answers
70 views

I have managed to get the searching to work with our existing systems however i have noticed that if items with the same "Value" are returned at different levels. For example, if i am looking for people by their username/name so if i have a person named "sysadmin" who is also part of a group called "Administrators" they are returned at two different levels within the tree and selecting both of them results in the selection appearing multiple times within the textbox. Is there some way that i can link these two (or more) items?

 

The other problem i am having is that when data is fetched from the server, we also provide an indicator that there are more matched results that are not returned in the search (because we are only displaying the first 20). The total number of matched results is returned as part of the response.

e.g.

{
  "Data": [/* 20 items */],
  "Total": 223
}

 

In our other dropdownlist selectors we use virtual scrolling to continuously fetch more results and in our grid and list view pages we use paging.

Is there some way that i can indicate to a user that there are more items that could have been returned but weren't? Either by including some sort of paging functionality or appending an indicator of some kind to the item list.

Plamen
Telerik team
 answered on 20 Nov 2019
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?