The dropdown tree data is sometimes loaded and rendered and other times not?

Q- The dropdown tree data is sometimes loaded and rendered and other times not?

Partial View

<div class="form-group col-lg-6 col-md-6 col-sm-6">

    <div class="e-float-input e-control-wrapper">

        <ejs-dropdowntree id="ParentSelectID" placeholder="@ResourcesWeb.ProjectManagementResource.ParentDivValue" changeOnBlur="false" cssClass="e-outline">

            <e-dropdowntree-fields dataSource="ViewBag.Divisions" hasChildren="IsParent" text="Value" value="ID" parentValue="ParentID"></e-dropdowntree-fields>

        </ejs-dropdowntree>

    </div>

</div>

<ejs-scripts></ejs-scripts>

Index.cshtml

<style>

    #Dialog {

        width: 20%;

        margin: auto;

        /*margin-top: 20px;*/

        min-height: 40%;

    }

</style>

@{

    var defaultAnimation = new Syncfusion.EJ2.Popups.DialogAnimationSettings { Effect = Syncfusion.EJ2.Popups.DialogEffect.Fade, Duration = 150, Delay = 0 };

}

<div id="Details" class="row ">

    <ejs-dialog id="Dialog" animationSettings="defaultAnimation" showCloseIcon="true" isModal="true" target="#Details" visible="false" created="Created" header="@ResourcesWeb.ProjectManagementResource.DivisionValue" beforeClose="Close">

        <e-content-template>

            <div>

                <div class="e-content">

                    <div id="DialogContent">

                    </div>

                </div>

            </div>

        </e-content-template>

    </ejs-dialog>

    <button type="button" onclick="GetDialog()"> Click</button>

</div>

@*New Division Dialog*@

<script>

    var val;

    function Created() {

        val = this;

    }

    function Close() {

        document.getElementById('DialogContent').innerHTML = "";

    }

    function GetDialog() {

        ej.popups.createSpinner({ target: document.getElementById('DialogContent') });

        ej.popups.showSpinner(document.getElementById('DialogContent'));

        var ajax = new ej.base.Ajax("@Url.Action("AddPartial", "SRMTest")", "GET", true);

        ajax.send();

        ajax.onSuccess = function (result) {

            if (document.getElementById('DialogContent')) {

                ej.popups.hideSpinner(document.getElementById('DialogContent'));

                document.getElementById('DialogContent').innerHTML = result;

                eval(document.getElementById('DialogContent').querySelector('script').innerHTML);

            }

        };

        ajax.onFailure = function (result) {

            if (document.getElementById('DialogContent')) {

                ej.popups.hideSpinner(document.getElementById('DialogContent'));

                document.getElementById('DialogContent').innerHTML = failed;

            }

        };

        val.show();

    }

</script>

Index Controller

using System;

using System.Collections.Generic;

using Microsoft.AspNetCore.Mvc;

namespace AssembleWeb.Controllers.Supplier

{

    public class SRMTestController : Controller

    {

        public IActionResult Index()

        {

            try

            {

                return View("Views/Supplier/SRMTesting.cshtml");

            }

            catch (Exception ex)

            {

                return BadRequest($"Error getting from api: {ex.Message},{ex.InnerException}");

            }

        }

        public IActionResult AddPartial()

        {

            ViewBag.Divisions = new List<TestModel>() {

                new TestModel { ID = 1, Value = "1-Value1", IsParent = true},

                new TestModel { ID = 2, Value = "1-Value2", IsParent = false, ParentID = 1},

                new TestModel { ID = 3, Value = "2-Value1", IsParent = true},

                new TestModel { ID = 4, Value = "2-Value2", IsParent = false, ParentID = 3}

            };

            return PartialView("Views/Supplier/PartialTest.cshtml");

        }

    }

    public class TestModel

    {

        public int ID { get; set; }

        public string Value { get; set; }

        public bool IsParent { get; set; }

        public int? ParentID { get; set; }

    }

}

1 (2).png

2 (2).png

Thanks for all.


1 Reply

IL Indhumathy Loganathan Syncfusion Team March 23, 2022 02:46 PM UTC

Hi Ahmed,  
 
Greetings from Syncfusion support. 
 
We have prepared a simple partial view sample to render Dropdown Tree component inside Dialog component and validated the reported query. But unable to reproduce the issue at our end. The Dropdown Tree data loaded properly even when expanding and collapsing the dropdown. Please check the sample for reference. 
 
 
Since we unable to replicate the issue at our end, kindly share us a issue replicate sample or replicate the issue in the above sample. Share us a video footage of issue. These details would help us assist you promptly. 
 
Regards, 
Indhumathy L 


Loader.
Up arrow icon