javascript - 如何在表单面板中添加网格面板?

标签 javascript extjs gridpanel

下面是我的 ExtJs 3.2 代码,用于在表单面板中添加网格面板。不起作用。

function test(){//will be called after clicking on save, added now
    var addForm="";
    var addGrid="";

    addForm=new Ext.FormPanel({
        frame: true,
        items:[
               new Ext.form.FormPanel({
                   title:'Select Start Point',
                   id:'startpoints',
                   autoHeight: false,
                   frame: true,
                   monitorValid: true,

                   items:[{
                       xtype: 'combo',
                       fieldLabel:'Start Point',
                       width:150,
                       name: 'startpoint',
                       emptyText:'Select Start Point',
                       store:pointstore,
                       mode: 'local',
                       displayField:'start_point',
                       valueField:'start_point',
                       typeAhead: true,
                       triggerAction: 'all',
                       selectOnFocus:true,
                       forceSelection: true,
                       allowBlank:false


                   }],

               }),

               new Ext.form.FormPanel({
                   title:'Select End Point',
                   id:'endpoints',
                   autoHeight: false,
                   frame: true,
                   monitorValid: true,

                   items:[{
                       xtype: 'combo',
                       fieldLabel:'End Point',
                       width:150,
                       name: 'waypoint',
                       emptyText:'Select End Point',
                       store:pointstore,
                       mode: 'local',
                       displayField:'way_point',
                       valueField:'way_point',
                       typeAhead: true,
                       triggerAction: 'all',
                       selectOnFocus:true,
                       forceSelection: true,
                       allowBlank:false


                   }],

               }),
                   //way point combo
                   new Ext.form.FormPanel({
                       title:'Select Way Point',
                       id:'waypoints',
                       autoHeight: false,
                       frame: true,
                       monitorValid: true,

                       items:[{
                       xtype: 'combo',
                           fieldLabel:'Way Point',
                           width:150,
                           name: 'waypoint',
                           emptyText:'Select Way Point',
                           store: pointstore,
                           mode: 'local',
                           displayField:'way_point',
                           valueField:'way_point',
                           typeAhead: true,
                           triggerAction: 'all',
                           selectOnFocus:true,
                           forceSelection: true,
                           allowBlank:false


                       }],
                       buttonAlign: 'center',
                       buttons:[{
                           text:'Add'


                       }]

                   }),

             ],//end of item



           buttons:[{
               text: 'Ok',
               //logic for Ok

           },{
               text:'Cancel',
              //logic for Cancel 
               handler: function(){
                    addWindow.close();

                }

           }]

    });//end of Form Pannel

    var grid_panel=new Ext.grid.EditorGridPanel({
        id: 'grid',
        border:true,
        frame:true,
        height:150,
        title:'Way Point Selection',
        hideHeaders:true,
        store: pointstore


    });

        addWindow=new Ext.Window({
        title: 'Enter Details',
        closable: false,
        modal:true,
        width: 295,
        autoHeight: true,
        items: [addForm],
            items:[grid_panel]
}).show();


}//end of function test

如果我评论“items:[grid_panel]”,我会得到一个窗口。 我想在“添加”按钮后面添加一个网格面板,以便每次单击添加时,都应该在其中添加点。我该怎么做。请给我代码。我遇到过一些类似的问题但没有用。我无法发布图像,因为 stackexchange 不允许我:-(

最佳答案

 Ext.create('Ext.form.Panel', {
            bodyPadding: 10,
            width: 200,
            title: 'Languages',
            items: grid,
            renderTo: Ext.getBody()
        });

试试这个..

关于javascript - 如何在表单面板中添加网格面板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19265939/

相关文章:

javascript - React 中客户端身份验证的示例

javascript - 在 Mongoose 中创建多对多关系,填充不是函数

javascript - 如何更改 Jssor Image Slider 的尺寸而不失去其仅在 iPhone 设备上的响应性质、图像纵横比等?

javascript - EXT JS表单面板中initComponent和onRender的区别

extjs - 如何在 MVC 模式中包含 UX 类?

Mozilla 中出现 Javascript 错误,但 Chrome 中没有

extjs - 是否可以为图表添加标题?

javascript - sencha 触摸过滤器商店列表?

extjs - 防止网格面板的键盘多选

layout - 我可以强制 JavaFX 的 GridPane 均匀分配空间吗?