PDA

View Full Version : [CLOSED] cannot get selected or checked nodes to server



susanz
Oct 27, 2014, 11:46 PM
I have a treePanel, it sometime allows single select some time multiple select with check box. when user click "Apply" button, I need to get selected or checked nodes from server code. Both SelectedNode and CheckedNode always show null value. not sure what I missed. By the way, is there other better way to achieve this ?
Thanks
szhang



@(X.Panel()
.ID("Hierarchy-" + Model.GridID)
.Title("Hierarchy")
.AutoScroll(true)
.BodyPadding(6)
.Layout(LayoutType.Border)
.TopBar(
X.Toolbar()
.Items(
X.Button()
.Icon(Icon.Accept)
.Text("Apply Changes")
.Handler ("SubmitMemberTree(this.up('panel'));")
)
)
.Items(
X.TreePanel()
.ID("DimMemberTree")
.Title("Select Member:")
.Border(false)
.Region(Region.West)
.Floatable(false)
.Width(300)
.Collapsed(false)
.Split(true)
.Collapsible(true)
.UseArrows(true)
.AutoScroll(true)
.Animate(true)
//.SubmitUrl(Url.Action("SubmitMemberTree", "Selector", new { gridID = @Model.GridID, selectorType = @Model.SelectorType }))
.Store(
X.TreeStore()
.Proxy(
X.AjaxProxy().Url(Url.Action("LoadDimChildren", "Selector"))
)
.Parameters(p =>
{
p.Add(X.StoreParameter().Name("dimName").Value(Model.DimName));
})
)
.Root(Model.MemberTree)
.RootVisible(false)
.MultiSelect(Model.MultiSelect)
.View(
X.TreeView()
.LoadingText("Loading Grid Data...")
)// end view

//,X.Panel()
// .Region(Region.Center)
// .ID("SelectedItemPanel")
// .Title("Selected Members")


)
)

<script>
var SubmitMemberTree = function () {
//if (App.DimMemberTree.CheckedNodes == null && App.DimMemberTree.SelectedNodes == null)
//{
// alert("Must select a node");
// return;
//}
Ext.net.DirectMethod.request({
url: '/Selector/SubmitMemberTree',
params: {
containerId: "DimMemberTree",
gridID: @Model.GridID + "",
multiSelect: "@Model.MultiSelect"
},
success: function (result) {
App.SelectorDlg.Close();
},
failure: function (result) {
Ext.Msg.notify("Error", result.ErrorMessage);
}
});

}
</script>

Controller:

public ActionResult SubmitMemberTree (string containerId, string gridID, string multiSelect)
{
var tree = this.GetCmp<TreePanel> (containerId);
var s = tree.SelectedNodes; // this never has any value
var c = tree.CheckedNodes; // this never has any value

return this.Direct();
}

susanz
Oct 27, 2014, 11:48 PM
the client side code also not get any selected/check values:

if (App.DimMemberTree.CheckedNodes == null && App.DimMemberTree.SelectedNodes == null)
{
alert("Must select a node");
return;
}

Daniil
Oct 28, 2014, 11:29 AM
Hi @susanz,

Please review #3:
Forum Guidelines For Posting New Topics (http://forums.ext.net/showthread.php?3440)

susanz
Oct 28, 2014, 4:21 PM
Sorry, added [Code] tag.
-szhang

Daniil
Oct 28, 2014, 5:01 PM
Please do the same for the post #2.

susanz
Oct 28, 2014, 5:12 PM
Please close this thread. I change to different implementation. Thanks
-szhang