1

我是 ExtJS 的新手,并尝试在网格底部添加一个按钮。此按钮将打开一个模式对话框以选择更多人。我不知道如何在网格之后添加这个按钮。我必须使用除 GridPanel 之外的其他组件吗?

有人可以帮助我吗?

代码如下所示:

var selectedPersons = [
    [1, 'Persnr', 'Name', 'Vorname']
];

var store = new Ext.data.ArrayStore({
    fields: [
        {name: 'PrsOid', type: 'int'},
        {name: 'PersonalNr'},
        {name: 'Nachname'},
        {name: 'Vorname'}
    ]
});

store.loadData(selectedPersons);

var grid = new Ext.grid.GridPanel({
    store: store,
    columns: 
    [
        {
            id       : 'PersonalNr',
            header   : 'PersonalNr', 
            width    : 100,
            sortable : true, 
            dataIndex: 'PersonalNr'
        },
        {
            header   : 'Nachname', 
            width    : 100,
            sortable : true, 
            dataIndex: 'Nachname'
        },
        {
            header   : 'Vorname', 
            width    : 100,
            sortable : true, 
            dataIndex: 'Vorname'
        }
    ],
    stripeRows: true,
    autoExpandColumn: 'PersonalNr',
    height: 200,
    //width: 460,
    title: 'Personenauswahl',
    // config options for stateful behavior
    stateful: true,
    stateId: 'grid'
    });

    grid.render('gridSelectedPersons');
4

1 回答 1

3

你的意思是像底栏这样的东西吗?

var grid = new Ext.grid.GridPanel({
    store: store,
    columns: 
    [
       ....
    ],
    stripeRows: true,
    autoExpandColumn: 'PersonalNr',
    bbar: new Ext.Toolbar({
         renderTo: document.body,
         height: 30,
         items: [
           // begin using the right-justified button container
           '->',
           {
             xtype:'button',
             text:'The button',
             //makes the button 24px high, there is also 'large' for this config
             scale: 'medium'
           }
         ]
        })
于 2012-03-28T10:23:33.590 回答