rgraham
Dec 11, 2019, 5:02 PM
We have this code in our V2 ascx markup:
<ext:Panel runat="server" Width="270" ID="mainMenuPanel" Border="false" Layout="AccordionLayout" AutoScroll="true" Region="Center">
<Items>
<ext:TreePanel
ItemID="panel-menu"
runat="server"
ID="MainPanel"
RootVisible="false" Title="Views" Border="false" Layout="FitLayout">
<SelectionModel>
<ext:TreeSelectionModel runat="server" ID="treeSelectionModel" Mode="Single" />
</SelectionModel>
<Store>
<ext:TreeStore ID="viewMenuStore" runat="server">
<Proxy>
<ext:RestProxy Url="~/api/menu/{0}" Json="true">
<ExtraParams>
<ext:Parameter Name="module" Value="Purchasing" Mode="Value" />
</ExtraParams>
</ext:RestProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
</ext:TreePanel><ext:Panel runat="server" Width="270" ID="mainMenuPanel" Border="false" Layout="AccordionLayout" AutoScroll="true" Region="Center">
<Items>
<ext:TreePanel
ItemID="panel-menu"
runat="server"
ID="MainPanel"
RootVisible="false" Title="Views" Border="false" Layout="FitLayout">
<SelectionModel>
<ext:TreeSelectionModel runat="server" ID="treeSelectionModel" Mode="Single" />
</SelectionModel>
<Store>
<ext:TreeStore ID="viewMenuStore" runat="server">
<Proxy>
<ext:RestProxy Url="~/api/menu/{0}" Json="true">
<ExtraParams>
<ext:Parameter Name="module" Value="Purchasing" Mode="Value" />
</ExtraParams>
</ext:RestProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
</ext:TreePanel>...
This is the ApiController call:
[Route("api/menu/{node}/{module}")]
[HttpGet]
public HttpResponseMessage GetNodes(string node, string module)
{
NodeCollection nodes = new NodeCollection(false);
var tree = PurchasingService.TreeBuilder(module);
tree.ToList().ForEach(d =>
{
Node node1 = CreateNewNode(d.Entity, Icon.Folder, !(d.ChildNodes != null && d.ChildNodes.Count() > 0));
if (d.ChildNodes != null)
{
CreateChildNode(d.ChildNodes, node1);
}
nodes.Add(node1);
});
var response = this.Request.CreateResponse(HttpStatusCode.OK);
response.Content = new StringContent(nodes.ToJson(), Encoding.UTF8, "application/json");
return response;
}
It returns this JSON:
[{"id":"1","iconCls":X.net.RM.getIcon("Folder"),"text":"Custom Views","children":[{"id":"1263","leaf":true,"iconCls":X.net.RM.getIcon("Star"),"text":"StatByAction"}]},
Nothing whatsoever displays. The "+" symbol in the tree changes to a hyphen, but not leafs or nodes display.
The examples I am seeing are using classic asmx web services, are there any using ApiController?
Thanks in advance.
<ext:Panel runat="server" Width="270" ID="mainMenuPanel" Border="false" Layout="AccordionLayout" AutoScroll="true" Region="Center">
<Items>
<ext:TreePanel
ItemID="panel-menu"
runat="server"
ID="MainPanel"
RootVisible="false" Title="Views" Border="false" Layout="FitLayout">
<SelectionModel>
<ext:TreeSelectionModel runat="server" ID="treeSelectionModel" Mode="Single" />
</SelectionModel>
<Store>
<ext:TreeStore ID="viewMenuStore" runat="server">
<Proxy>
<ext:RestProxy Url="~/api/menu/{0}" Json="true">
<ExtraParams>
<ext:Parameter Name="module" Value="Purchasing" Mode="Value" />
</ExtraParams>
</ext:RestProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
</ext:TreePanel><ext:Panel runat="server" Width="270" ID="mainMenuPanel" Border="false" Layout="AccordionLayout" AutoScroll="true" Region="Center">
<Items>
<ext:TreePanel
ItemID="panel-menu"
runat="server"
ID="MainPanel"
RootVisible="false" Title="Views" Border="false" Layout="FitLayout">
<SelectionModel>
<ext:TreeSelectionModel runat="server" ID="treeSelectionModel" Mode="Single" />
</SelectionModel>
<Store>
<ext:TreeStore ID="viewMenuStore" runat="server">
<Proxy>
<ext:RestProxy Url="~/api/menu/{0}" Json="true">
<ExtraParams>
<ext:Parameter Name="module" Value="Purchasing" Mode="Value" />
</ExtraParams>
</ext:RestProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
</ext:TreePanel>...
This is the ApiController call:
[Route("api/menu/{node}/{module}")]
[HttpGet]
public HttpResponseMessage GetNodes(string node, string module)
{
NodeCollection nodes = new NodeCollection(false);
var tree = PurchasingService.TreeBuilder(module);
tree.ToList().ForEach(d =>
{
Node node1 = CreateNewNode(d.Entity, Icon.Folder, !(d.ChildNodes != null && d.ChildNodes.Count() > 0));
if (d.ChildNodes != null)
{
CreateChildNode(d.ChildNodes, node1);
}
nodes.Add(node1);
});
var response = this.Request.CreateResponse(HttpStatusCode.OK);
response.Content = new StringContent(nodes.ToJson(), Encoding.UTF8, "application/json");
return response;
}
It returns this JSON:
[{"id":"1","iconCls":X.net.RM.getIcon("Folder"),"text":"Custom Views","children":[{"id":"1263","leaf":true,"iconCls":X.net.RM.getIcon("Star"),"text":"StatByAction"}]},
Nothing whatsoever displays. The "+" symbol in the tree changes to a hyphen, but not leafs or nodes display.
The examples I am seeing are using classic asmx web services, are there any using ApiController?
Thanks in advance.