We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Show different information in Dropdown depending of the level of the row??

Thread ID:





129293 Mar 9,2017 07:53 PM Mar 13,2017 04:36 AM ASP.NET MVC 3
Tags: TreeGrid
Alberto Barrera
Asked On March 9, 2017 07:53 PM

How can I display other information in the Dropdown when I start editing the cell?

Here is my code:

    var opt = new Syncfusion.JavaScript.Models.DropDownListProperties();
    opt.DataSource = ViewBag.Types;
    opt.DropDownListFields.Text = "Name";
    opt.DropDownListFields.Value = "Name";

           .Datasource(ds => ds.Json(ViewBag.DomainAccess)
           .FilterSettings(filter => filter.FilterType(TreeGridFilterType.Menu))
           .ToolbarSettings(tool =>
               tool.ToolbarItems(new List<TreeGridToolBarItems>()
               TreeGridToolBarItems.Add, TreeGridToolBarItems.Edit,
               TreeGridToolBarItems.Delete, TreeGridToolBarItems.Update,
               TreeGridToolBarItems.Cancel, TreeGridToolBarItems.ExpandAll,
           .EditSettings(edit =>
           .Columns(column =>
               column.Field("IdParent").HeaderText("ID Parent").Visible(false).Add();
       .ContextMenuSettings(cms => cms.ShowContextMenu(true)
            .ContextMenuItems(new List<TreeGridContextMenuItems>()

Any ideas on how to do that?

Jayakumar Duraisamy [Syncfusion]
Replied On March 10, 2017 07:43 AM

Hi Alberto, 
Thanks for contacting Syncfusion support. 
We can load different data source for dropdown control on editing the dropdown columns. This can be achieved this by using “BeforePopShown” client side event in dropdown list control. 
We can bind this event by using “DropDownEditOptions” in TreeGrid column property. 
In handler function we can update the data source of dropdown list control by using setModel method. 
Please refer following code snippet, 
    var opt = new Syncfusion.JavaScript.Models.DropDownListProperties(); 
    opt.DataSource = ViewBag.dropData; 
    opt.DropDownListFields.Text = "text"; 
    opt.DropDownListFields.Value = "value"; 
    opt.BeforePopupShown = "beforeOpen"; // Client side event 
    <script type="text/javascript"> 
        function beforeOpen(args) { 
            var treegridObj = $("#TreeGridContainer").data("ejTreeGrid"); 
            record = treegridObj.model.selectedItem, 
            dataSource = args.model.dataSource; 
            data = [];            
            if (record.level == 0) 
                data = dataSource.slice(0, 4); 
            else if (record.level == 1) 
                data = dataSource.slice(4, 8); 
            else if (record.level == 2) 
                data = dataSource.slice(8, 12); 
            this.setModel({"dataSource": data}); // Update new data in the dropdown list 
We have prepared a sample for your reference, In this sample we have modified the dropdown data with respect to level of TreeGrid record. 
Please find the sample from below location. 
Please let us know if you require more assistance on this. 
Jayakumar D 

Alberto Barrera
Replied On March 10, 2017 07:54 PM

It worked correctly!

Thanks for your quick support.

Jayakumar Duraisamy [Syncfusion]
Replied On March 13, 2017 04:36 AM

Hi Alberto,  
We are glad to know that your issue has resolved. 
Please let us know if you require further assistance on this. 
Jayakumar D 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.