Telerik Forums
UI for ASP.NET MVC Forum
1 answer
25 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
0 answers
66 views

Hi Team,

We are facing problems in below scenarios, Request help on the same.

We have data based parent and their child nodes and it is binding properly however, we wanted to implement functionality like we need to display only parent node for their selected nodes. (currently, it is displaying all nodes including parents and their childs.)

Request help on the asap asap.

 

Nikunj
Top achievements
Rank 1
 asked on 08 Apr 2023
1 answer
93 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
0 answers
651 views

Hello, I`ve got web application written on asp .net MVC.

In my view page I`ve got access to $(...).kendoDropDownList function, but when I try to call kendoDropDownTree  on same view I get an error : 

Uncaught TypeError: $(...).kendoDropDownTree is not a function.

I already  checked the sequence definition  of jQuery library and kento libraries and jquery goest firs. 

Any Ideas?

 


 

Gavrail
Top achievements
Rank 1
 updated question on 02 Feb 2022
1 answer
258 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
165 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
506 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
588 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
249 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.4K+ 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?