javascript - 如何将网格添加到选项卡面板

标签 javascript css extjs

如何在选项卡面板的中心添加网格..我的网格没有边距,style:{margintop:'10px'} even height: and width:

这是我的网格:-

{
        title: 'Credit Card',
        id:'credit_tab',
        html:'html',
        items:[{ 
                    xtype:'grid',

                    title: 'Simpsons',
                    resizable: true,
                   // margins:'20 20 20 20',
                    style:{marginLeft:'200px',marginTop:'30px'},
                    //store: Ext.data.StoreManager.lookup('simpsonsStore'),
                    columns: [
                        { header: 'Name',  dataIndex: 'name' },
                        { header: 'Email', dataIndex: 'email', flex: 1 },
                        { header: 'Phone', dataIndex: 'phone' }
                    ],
                  //  height: 100,
                    width: 100,
                  // renderTo:Ext.getBody()
                }]

         }

最佳答案

尝试将网格嵌套到容器中。然后,您可以从容器中尝试不同的尺寸和布局,以将其准确放置在您想要的位置。这是一个例子。

我会删除“样式”填充/位置,至少要开始并查看您在容器中的喜好。然后从那里垫/位置。试试这个:

 {
    title: 'Credit Card',
    id:'credit_tab',
    html:'html',
    items:[{
            xtype: 'container',
            layout: {
                type: 'hbox',
                align: 'center',
                pack: 'center', 
            },

            items: [{ 
                    xtype:'grid',   
                    title: 'Simpsons',
                    resizable: true,
                   // margins:'20 20 20 20',
                    height: 200,
                    //store: Ext.data.StoreManager.lookup('simpsonsStore'),
                    columns: [
                        { header: 'Name',  dataIndex: 'name' },
                        { header: 'Email', dataIndex: 'email', flex: 1 },
                        { header: 'Phone', dataIndex: 'phone' }
                    ],
                  //  height: 100,
                    width: 500, 
                  // renderTo:Ext.getBody()
                }]  
        }]

     }

关于javascript - 如何将网格添加到选项卡面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32008943/

相关文章:

javascript - 在经典 ASP 中将日期转换为 GMT

javascript - 防止 iframe 中的 location.hash 在 Chrome 中滚动父窗口

javascript - jQuery - 选择有 child 的 parent

extjs - 销毁 div 元素内的 Ext 组件

dom - Extjs DomQuery 如何遍历Dom元素

javascript - 有没有办法在 html5 源视频标签上使用字节数组

javascript - meteorjs 使用外部 mongoDb

javascript - 我如何使用 jquery mobile 在两个单独的 html 文件之间传递对象

html - CSS 选择多个标签

sencha-touch - 水平滚动列表