首页 新闻 会员 周边 捐助

EXT.NET 关于TreePanel刷新问题

0
悬赏园豆:140 [已关闭问题] 关闭于 2014-01-20 11:17

第一次接触Ext.Net控件,想实现以上功能,但是我试了几天都不行,求高手指点下

功能如下:

问题项是根据问题类型来加载数据的

 

部分代码:

        //-------
                    Html.X().ComboBox().ID("CbType").Name("CbType").FieldLabel("问题类型").Editable(false).LabelWidth(60).Items(
                    new ListItem { Value = "0", Text = "内部" },
                    new ListItem { Value = "1", Text = "外部" }
                    )
                    .SelectedItems(Html.X().ListItem().Value("0").Text("内部"))
                    .Listeners(l => l.Select.Handler = "#{HidType}.setValue(this.getValue());Ext.getCmp('TreePanel1').setRootNode()"),
                    Html.X().Hidden().Name("Type").ID("HidType").Value("0"),
        //-------
                    Html.X().DropDownField().Name("Level").ID("CBLevel").FieldLabel("问题项").LabelAlign(LabelAlign.Left).LabelWidth(60).AllowBlank(false).Editable(false).Mode(DropDownMode.ValueText).EmptyText("请选择...")
                    .Component(c =>
                        c.Add(Html.X().TreePanel().ID("TreePanel1").Shadow(false).UseArrows(true).MaxHeight(250).MinHeight(50).Width(500)
                                .AutoScroll(true).Animate(false).RootVisible(false).Header(false).Root(new Node { NodeID = "-", Text = "Root" })
                                .Store(
                                    Html.X().TreeStore().ID("TreeStore1")
                                    .Root(new Node
                                            {
                                                NodeID = "-",
                                                Text = "Root"
                                            })
                                    .Proxy(new AjaxProxy
                                            {
                                                API = { Read = Url.Action("GetLevel") },
                                                ActionMethods = { Read = HttpMethod.GET }
                                            })
                                   .Parameters(ps => ps.Add(new StoreParameter("type", "0")))
                                )
                                .Listeners(l =>
                                {
                                    l.ItemClick.Handler = "if(record.childNodes.length>0){Ext.Msg.alert('错误','请选择子节点');}else{this.dropDownField.setValue(record.data.id,record.data.text,true);}";
                                })
                              )
                            )
View Code

 

like%'远远'%的主页 like%'远远'% | 小虾三级 | 园豆:635
提问于:2014-01-20 03:41
< >
分享
所有回答(3)
0

帮顶~

刘志勇 | 园豆:261 (菜鸟二级) | 2014-01-20 08:49
0

自己换种方式实现了,数据库设计成3层即可

like%'远远'% | 园豆:635 (小虾三级) | 2014-01-20 11:17

我用mvc模式做过。你做过TreePanel吗

支持(0) 反对(0) 小二炒豆芽菜 | 园豆:418 (菜鸟二级) | 2014-07-09 10:37
0

    <ext:ComboBox ID="MIDDLECODE" runat="server" FieldLabel="中类代码" LabelWidth="60" DisplayField="NAME" ValueField="MIDDLECODE"   EmptyText="请选择....." AllowBlank="false">                        <Store>                            <ext:Store runat="server" ID="storecboMiddleCode">                                 <Model>                                   <ext:Model ID="Model2" runat="server" IDProperty="MIDDLECODE" >                                     <Fields>                                       <ext:ModelField Name="MIDDLECODE" ></ext:ModelField>                                       <ext:ModelField Name="NAME"></ext:ModelField>                                     </Fields>                                   </ext:Model>                                 </Model>                            </ext:Store>                        </Store>                           <DirectEvents>                             <Change OnEvent="CboMiddleCodeChange" />                          </DirectEvents>                     </ext:ComboBox>     

                    <ext:ComboBox ID="SMALLCODE" runat="server" FieldLabel="小类代码" LabelWidth="60" DisplayField="NAME" ValueField="SMALLECODE"  EmptyText="请选择....." AllowBlank="false" >                        <Store>                            <ext:Store runat="server" ID="storecboSmallCode">                                 <Model>                                   <ext:Model ID="Model3" runat="server" IDProperty="SMALLCODE">                                     <Fields>                                       <ext:ModelField Name="SMALLCODE" ></ext:ModelField>                                       <ext:ModelField Name="NAME"></ext:ModelField>                                     </Fields>                                   </ext:Model>                                 </Model>                            </ext:Store>                        </Store>                     </ext:ComboBox>     

 

 

 

 

 

 

     //中类联动小类
        public void CboMiddleCodeChange(object sender, DirectEventArgs e)
        {
            if (this.MIDDLECODE.SelectedItem != null)
            {
                string middleType = this.MIDDLECODE.SelectedItem.Value;
                CResult Reslut = smallCode_Bus.GetByStr("MIDDLECODE='" + middleType + "'", "SMALLCODE");
                if (Reslut.Value != null && Reslut.Success)
                {
                    this.storecboSmallCode.DataSource = Reslut.Value as DataTable;
                    this.storecboSmallCode.DataBind();
                }
            }
        }

冷血液 | 园豆:206 (菜鸟二级) | 2015-06-12 17:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册