Skip to content

Commit 7f6493b

Browse files
committed
938381: Test and resolve issues in UG all sections - ASP MVC Dropdown Tree control.
1 parent 9f61412 commit 7f6493b

File tree

8 files changed

+25
-21
lines changed

8 files changed

+25
-21
lines changed
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
<div id='container' style="margin:0 auto; width:250px;">
2-
@Html.EJS().DropDownTree("tree").Fields(field =>
3-
field.Query("new ej.data.Query().from('Employees').select('EmployeeID,FirstName,Title').take(5)").Value("EmployeeID").ParentValue("pid").Selected("selected")
4-
.Text("FirstName").HasChildren("EmployeeID")
5-
.DataSource(dataSource =>
6-
{
7-
dataSource.Url("https://services.odata.org/V4/Northwind/Northwind.svc").Adaptor("ODataV4Adaptor").CrossDomain(true);
8-
}).Child(ViewBag.child)).Render()
2+
@Html.EJS().DropDownTree("ddtremote").Placeholder("Select a name").Fields(ViewBag.remoteFields).Render()
93
</div>

ej2-asp-core-mvc/code-snippet/dropdowntree/data-binding/remote-data/remotedata.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,30 @@ namespace DropDownTree.Controllers
1111
{
1212
public class DropDownListController : Controller
1313
{
14-
public IActionResult RemoteData()
14+
public ActionResult RemoteData()
1515
{
16+
DropDownTreeFields parentData = new DropDownTreeFields();
1617
DropDownTreeFields childData = new DropDownTreeFields();
17-
childData.Query = "new ej.data.Query().from('Orders').select('OrderID,EmployeeID,ShipName').take(5)";
18-
childData.Value = "OrderID";
19-
childData.Text = "ShipName";
20-
childData.ParentValue = "EmployeeID";
21-
childData.DataSource = new Syncfusion.EJ2.DataManager
18+
object data = new DataManager
2219
{
2320
Url = "https://services.odata.org/V4/Northwind/Northwind.svc",
2421
Adaptor = "ODataV4Adaptor",
2522
CrossDomain = true
2623
};
27-
ViewBag.child = childData;
24+
// Parent data mapping
25+
parentData.Query = "new ej.data.Query().from('Employees').select('EmployeeID,FirstName,Title').take(5)";
26+
parentData.Value = "EmployeeID";
27+
parentData.Text = "FirstName";
28+
parentData.HasChildren = "EmployeeID";
29+
parentData.Child = childData;
30+
parentData.DataSource = data;
31+
// Child data mapping
32+
childData.Query = "new ej.data.Query().from('Orders').select('OrderID,EmployeeID,ShipName').take(5)";
33+
childData.Value = "OrderID";
34+
childData.Text = "ShipName";
35+
childData.ParentValue = "EmployeeID";
36+
childData.DataSource = data;
37+
ViewBag.remoteFields = parentData;
2838
return View();
2939
}
3040
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="control-section">
22
<div style="margin: 0 auto; width:350px;">
3-
@Html.EJS().DropDownTree("ddtremote").Placeholder("Select a name").PopupHeight("200px").ActionFailureTemplate("<span class='action-failure'> Data fetch request fails</span>").Fields(ViewBag.remoteFields).Render()
3+
@Html.EJS().DropDownTree("ddtremote").Placeholder("Select a name").Width("300px").PopupHeight("200px").ActionFailureTemplate("<span class='action-failure'> Data fetch request fails</span>").Fields(ViewBag.remoteFields).Render()
44
</div>
55
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@using Syncfusion.EJ2.DropDowns
22
<div class="control-section">
33
<div style="margin: 0 auto; width:350px;">
4-
@Html.EJS().DropDownTree("ddt").Placeholder("Select an employee").Mode(Mode.Custom).CustomTemplate("${value.length} item(s) selected").ShowCheckBox(true).PopupHeight("200px").Fields(ViewBag.templateData).Render()
4+
@Html.EJS().DropDownTree("ddt").Width("300px").Placeholder("Select an employee").Mode(Mode.Custom).CustomTemplate("${value.length} item(s) selected").ShowCheckBox(true).PopupHeight("200px").Fields(ViewBag.templateData).Render()
55
</div>
66
</div>

ej2-asp-core-mvc/code-snippet/dropdowntree/templates/footerTemplate/razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="control-section">
22
<div style="margin: 0 auto; width:350px;">
3-
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("350px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div class=\"ename\">${name}</div>").FooterTemplate("<div class=\"footer\"><div class=\"footer-content\">Total number of employees: 10 </div></div>").Render()
3+
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("300px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div class=\"ename\">${name}</div>").FooterTemplate("<div class=\"footer\"><div class=\"footer-content\">Total number of employees: 10 </div></div>").Render()
44
</div>
55
</div>
66
<style>

ej2-asp-core-mvc/code-snippet/dropdowntree/templates/headerTemplate/razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="control-section">
22
<div style="margin: 0 auto; width:350px;">
3-
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("350px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div class=\"ename\">${name}</div>").HeaderTemplate("<div class=\"head\">Employee List</div>").Render()
3+
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("300px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div class=\"ename\">${name}</div>").HeaderTemplate("<div class=\"head\">Employee List</div>").Render()
44
</div>
55
</div>
66
<style>

ej2-asp-core-mvc/code-snippet/dropdowntree/templates/itemTemplate/razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="control-section">
2-
<div style="margin: 0 auto; width:350px;">
3-
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("350px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div><span class=\"ename\">${name} - </span><span class=\"ejob\">${job}</span></div>").Render()
2+
<div style="margin: 0 auto; width:250px;">
3+
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("300px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div><span class=\"ename\">${name} - </span><span class=\"ejob\">${job}</span></div>").Render()
44
</div>
55
</div>
66
<style>

ej2-asp-core-mvc/code-snippet/dropdowntree/templates/valueTemplate/razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="control-section">
22
<div style="margin: 0 auto; width:350px;">
3-
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("350px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div><span class=\"ename\">${name} - </span><span class=\"ejob\">${job}</span></div>").ValueTemplate("<div><span class=\"ename\">${name} - </span><span class=\"ejob\">${job}</span></div>").Render()
3+
@Html.EJS().DropDownTree("ddt").CssClass("custom").Placeholder("Select an employee").Width("300px").PopupHeight("250px").Fields(ViewBag.templateData).ItemTemplate("<div><span class=\"ename\">${name} - </span><span class=\"ejob\">${job}</span></div>").ValueTemplate("<div><span class=\"ename\">${name} - </span><span class=\"ejob\">${job}</span></div>").Render()
44
</div>
55
</div>
66
<style>

0 commit comments

Comments
 (0)