在Extjs中動態增加控件


  Ext.onReady(function () {
            Ext.QuickTips.init();
            Ext.form.Field.prototype.msgTarget = 'side';

            var autoloadcontrol =new  Ext.form.FieldSet({
                layout: "column",
                title: "屬性表單",
            })
 var addForm = new Ext.FormPanel({
                 title: "<div align='center'>產品屬性管理</div>",
                 id: "addForm",
                 name: "addForm",
                 renderTo: Ext.getBody(),
                 autoHeight: true,
                 autoWidth: true,
                 labelWidth: 80,
                 frame: true,
                 items:  autoloadcontrol,
                 bbar: [{
                     xtype: "button",text:"addform", listeners: {
                         "click": function () {
                             Ext.Ajax.request({
                                 url: "/PropertyManage/ProductPropertyInfo.aspx",
                                 params: {  op: "test" },
                                 success: function (response) {
                                      //后台得到字符串
                                     autoloadcontrol.add(eval(response.responseText))
                                     autoloadcontrol.doLayout();   //用來刷新FormPanel
                                 },
                             })
                         }
                     }
                 }]
                
             });
         });            

  

        protected void Page_Load(object sender, EventArgs e)
        {
            switch (Request["op"])
            {
                case "test":
                    Response.Write("new Ext.form.TextField({filedLabel:'標題',emptyText:'請輸入內容',allowBlank:false,maxLength:50})");
                    Response.End();
                    break;
            }
        }

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM