Coolite TreePanel 작업 중 하나: TreePanel 새로 고침
5656 단어 TreePanel
function refreshTree(tree) {
tree.el.mask('Loading...', 'x-loading-mask');
Coolite.AjaxMethods.RefreshMenu({
success: function(result) {
var nodes = eval(result);
tree.root.ui.remove();
tree.initChildren(nodes);
tree.root.render();
tree.el.unmask();
},
failure: function(msg) {
tree.el.unmask();
Ext.Msg.alert('Failure', ' ');
}
});
}
Coolite.AjaxMethods.RefreshMenu 방법:
/// <summary>
/// Json
/// </summary>
/// <returns></returns>
[AjaxMethod]
public string RefreshMenu()
{
Coolite.Ext.Web.TreeNodeCollection nodes = LoadTree(this.TreePanelOrganization.Root);
return nodes.ToJson();
}
/// <summary>
/// 、 //WCF entity framework
/// </summary>
/// <param name="nodes"></param>
/// <returns>TreeNodeCollection</returns>
private Coolite.Ext.Web.TreeNodeCollection LoadTree(Coolite.Ext.Web.TreeNodeCollection nodes)
{
if (nodes == null)
{
nodes = new Coolite.Ext.Web.TreeNodeCollection();
}// null
TreePanelOrganization.Root.Clear();
Coolite.Ext.Web.TreeNode node = new Coolite.Ext.Web.TreeNode("Hisoft", "Hisoft", Icon.Group);
node.Qtip = "Hisoft";
nodes.Add(node);
node.Expanded = true;
// OrganizationService.OrganizationServiceClient client = new PMS.Web.Admin.OrganizationService.OrganizationServiceClient();
// client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
//
DCC_ResorganizationList organizationlist = client.GetOrganizationList("");
foreach (var superCode in organizationlist.ToList())
{
Coolite.Ext.Web.TreeNode supernode = new Coolite.Ext.Web.TreeNode();
string parentcode = superCode.OrganizationCode;
supernode.NodeID = superCode.OrganizationCode;
supernode.Text = superCode.OrganizationName;
supernode.Qtip = superCode.OrganizationFullName;
supernode.Cls = superCode.OrganizationID;
//supernode.Expanded = true;
supernode.Icon = Icon.GroupKey;
//supernode.CustomAttributes.Add(new ConfigItem(
node.Nodes.Add(supernode);
LoadOrgRoleByOrganizationID(superCode.OrganizationID, supernode);
CreateCycleTree(parentcode, supernode);
}
return nodes;
//linq to sql class
//IList<RES_Organization> OrgSuperDepartment = OrgData.GetCycleOrganization("", context);
//foreach (var superCode in OrgSuperDepartment)
//{
// Coolite.Ext.Web.TreeNode supernode = new Coolite.Ext.Web.TreeNode();
// supernode.NodeID = superCode.organization_code;
// supernode.Text = superCode.organization_name;
// supernode.Qtip = superCode.organization_full_name;
// supernode.Icon = Icon.GroupKey;
// node.Nodes.Add(supernode);
// CreateCycleTree(supernode.NodeID, supernode);
//}
}
/// <summary>
///
/// </summary>
/// <param name="code"> code</param>
/// <param name="parentcode"> </param>
private void CreateCycleTree(string code, Coolite.Ext.Web.TreeNode parentcode)
{
// OrganizationService.OrganizationServiceClient client = new PMS.Web.Admin.OrganizationService.OrganizationServiceClient();
// ID
DCC_ResorganizationList orgDepartment = client.GetOrganizationList(code);
// IList<RES_Organization> orgDepartment = OrgData.GetCycleOrganization(code, context);
foreach (var org in orgDepartment.ToList())
{
Coolite.Ext.Web.TreeNode node = new Coolite.Ext.Web.TreeNode();
string orgparentcode = org.OrganizationCode;
node.NodeID = org.OrganizationCode;
node.Text = org.OrganizationName;
node.Qtip = org.OrganizationFullName;
node.Cls = org.OrganizationID;
node.Icon = Icon.GroupGo;
parentcode.Nodes.Add(node);
LoadOrgRoleByOrganizationID(org.OrganizationID, node);
CreateCycleTree(orgparentcode, node);
}
}
스크립트 등록:
string JsFunction = "refreshTree(#{TreePanelOrganization})";
//string JsFunction = "alert('dd');";
//string JsFunction = "refreshTree()";
Coolite.Ext.Web.ScriptManager sm = Coolite.Ext.Web.ScriptManager.GetInstance(HttpContext.Current);
sm.AddScript(string.Format("{0};", JsFunction));
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Extjs4.xtreepanel,treegrid 노드 선택, 어떤 노드 선택텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.