PDA

View Full Version : [CLOSED] Select Node in treePanel after in loader frame



Tactem
Jun 23, 2014, 3:48 PM
Hi guys,

I have some troubles to select a node in treePanel in a frame.
I have the same object in my main frame and my child frame.
If i select in my main frame, it's work
but if i select in my child frame it doesn't work.

In my child frame, i can check nodes but not select.


js

var ApplyFavoriteNew = function (item) {
try {
var tabPanel = Ext.getCmp('PanelTab');
//It's work
Ext.getCmp('treePanelTelCat').getSelectionModel(). select(Ext.getCmp('treePanelTelCat').getRootNode() .firstChild);
var insertIndex = tabPanel.items.length - 1;
var idTab = guid();
tab = tabPanel.insert(insertIndex, {
id: idTab,
title: 'New',
closable: true,
iconCls: 'DashboardIcon',
layout: 'fit',
border: false,
loader: {
renderer: "frame",
url: AppPath + "DashBoardConfig/ApplyFavoriteInsideTab",
loadMask: {
showMask: true,
msg: TIO.Resources.PreparingDisplay
},
params:
{
id: item.Id
}
}

});

tabPanel.setActiveTab(tab);

}
catch (err) {
throwException(err, 'ApplyFavoriteNew');
}
};
var ApplyFavoriteNewBis = function (item) {
setTimeout(function () {
//It's doesn't work
Ext.getCmp('treePanelTelCat').getSelectionModel(). select(Ext.getCmp('treePanelTelCat').getRootNode() .firstChild);
}, 10000);
};


Controlleur


public ActionResult ApplyFavoriteInsideTab(int id)
{
FavoriteFolder favorite = _dashBoardFactoryService.GetFavoriteById(2, id);
X.Js.Call("ApplyFavoriteNewBis", favorite);
return View("PartialViewNewDashboard");
}


View

Html.X().TabPanel()
.Region(Region.Center)
.ID("PanelTab")
.Layout(LayoutType.Fit)
.Plugins(
Html.X().TabMenu()
)

@using Ext.Net
@using Ext.Net.MVC;

@{
var X = Html.X();
}

@model Int32

@(X.Panel()
.Layout(LayoutType.Fit)
.Border(false)
.TopBar(
X.Toolbar()
.BaseCls("tooltip")
.Items(
X.Label()
.Text(Html.GetResource("DashBoardSelector", "TooltipTelcat"))
.Height(15)
.Margin(5)
)
)
.Items(
X.TreePanel()
.ID("treePanelTelCat")
.UseArrows(true)
.RootVisible(false)
.Border(false)
.Store(
X.TreeStore()
.FolderSort(true)
.ID("treePanelTelCatTreeStore")
.Proxy
(
X.AjaxProxy()
.Url(Url.Action(("LoadTreeNode")))
)
.Parameters
(
p =>
{
p.Add(new StoreParameter("type", "TelecomCategories", ParameterMode.Value));
p.Add(new StoreParameter("other", Model.ToString(), ParameterMode.Value));
}
)
.Sorters
(
X.DataSorter()
.Property("text")
)
)
.Root
(
X.Node()
.Text("Root")
.Icon(Icon.Folder)
.Expanded(true)
)
.Listeners(p =>
{
p.CheckChange.Fn = "refreshArbreTelCatCheckedNew";
p.ItemClick.Fn = "onTelCatTreeItemClickNew";
p.AfterRender.Handler = "App.treePanelTelCat.expandAll();";
}
)
))

Do you have any ideas for this problem ?

Daniil
Jun 24, 2014, 2:42 PM
Hi @Tactem,

Any nodes should be selected in a ViewReady listener.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.panel.Table-event-viewready

Or use a TreeSelectionModel's SelectedRows.

Tactem
Jun 25, 2014, 10:59 AM
Thank you it's work