将所选记录作为rowexpander数据添加到可用网格中

时间:2013-09-02 10:26:58

标签: extjs extjs4

我有一个网格面板,员工可以从系统中选择文章。此外,还有两个字段,员工也必须填写这些字段。当员工单击按钮ADD(在本例中为EKLE)时,所选记录应添加具有此两个字段值的背景网格(LEVEL和VALUE字段)。系统无需字段值即可正常运行。我想通过rowexpander插件将这些字段值添加到后台网格中。

enter image description here

按钮代码

{
text: 'EKLE',
scale: 'medium',
disabled: true,
width: 100,
margin: '0 9 0 0',
cls: 'btn-article-save',
id: 'btnArticleSave',
name: '_btnArticle',
listeners: {
    click: function () {
        var sel = Ext.getCmp('article-grid').getSelectionModel().getSelection();
        Ext.each(sel, function (item, index) {
            arrArticle.push(item);
        });

        arrArticleStore.load();
        Ext.getCmp('articles-grid').getView().bindStore(arrArticleStore);
        Ext.getCmp('articles-grid').show();

        var alevel = Ext.ComponentQuery.query('textfield[name=artLevel]');
        var avalue = Ext.ComponentQuery.query('textfield[name=artValue]');
    }
}
}

背景网格代码

{
xtype: 'gridpanel',
id: 'articles-grid',
selType: 'rowmodel',
store: arrArticleStore,
elStatus: true,
hidden: true,
columnLines: true,
forceFit: true,
scroll: 'vertical',
width: 730,
height: 394,
columns: [
    {text: 'ARTICLE ID', dataIndex: 'ARTICLE_ID', hidden: true},
    {text: 'ARTİKEL TANIMI', dataIndex: 'ART_DESC', width: 210, flex: 2},
    {
        text: 'VARIANT TANIMI',
        dataIndex: 'SORTEN_TEXT',
        width: 120,
        flex: 1,
        renderer: function (value, metaData, record) {
            if (value == null) {
                return record.get('ART_DESC');
            } else {
                return record.get('SORTEN_TEXT');
            }
        }
    },
    {text: 'VARIANT', dataIndex: 'VAR', width: 72, align: 'center', flex: 0},
    {text: 'GEBI', dataIndex: 'GEBI', width: 72, align: 'center', flex: 0},
    {text: 'SUBSYS', dataIndex: 'SUBSYS_ART_NR', width: 72, align: 'right', flex: 0},
    {
        text: 'DNR ID',
        dataIndex: 'DNR_ID',
        width: 80,
        align: 'center',
        flex: 0,
        renderer: function (value, metaData, record) {
            if (value == 0) {
                return null;
            } else {
                return record.get('DNR_ID');
            }
        }
    },
    {text: 'STATUS', dataIndex: 'STATUS', hidden: true},
    {
        text: 'SİL',
        align: 'center',
        xtype: 'actioncolumn',
        width: 60,
        flex: 0,
        items: [
            {
                icon: '<?php echo img_url(); ?>delete.png',
                tooltip: 'DNR Bilgilerini Görüntüle',
            }
        ]
    }
],
style: {
    fontFamily: 'DINPro-Regular',
    fontSize: '10pt',
    marginBottom: '10px'
},
multiSelect: true,
viewConfig: {
    getRowClass: function (record) {
        if (record && record.get('STATUS') === 1) return 'article-available-row';
    }
}
}

0 个答案:

没有答案