简体   繁体   English

Extjs网格面板行单击

[英]Extjs Grid Panel Rowclick

I have a two GridPanel namely: 'grid1' and 'grid' under my mainPanel. 我的主面板下有两个GridPanel,分别是:“ grid1”和“ grid”。 Now, whenever I clicked or select a data in my 'grid1' panel, I want that data to appear also in my 'grid' panel and that is my problem. 现在,每当我在“ grid1”面板中单击或选择一个数据时,我都希望该数据也出现在“ grid1”面板中,这就是我的问题。

This is what I've tried so far: 到目前为止,这是我尝试过的:

     var grid1 = new Ext.grid.EditorGridPanel({
                id: 'editorgrid',
                store: store1,
                title: 'Animals',
                cm: cm1,

                width: 400,
                anchor: '100%',
                height: 700,

                frame: true,
                loadMask: true,
                waitMsg: 'Loading...',
                clicksToEdit: 1,
                tbar: [
                'Animals Unit  : ', '-',               
                {
                xtype: 'combo',
                name: 'animal_combo',
                id:'cboAnimal',
                anchor: '90%',
                allowBlank: false,
                editable: false, 
                forceSelection: true,
                triggerAction: 'all',
                mode: 'remote',
                store: new Ext.data.JsonStore({
                    url: '/index.php/getAnimalCombo',
                    root: 'data',
                    totalProperty: 'total',
                    fields: ['id','desc'],
                    params: {start: 0},
                    baseParams: {limit: 25}
                }),
                pageSize: 25,
                displayField: 'desc',
                valueField: 'id',
                minListWidth: 150,
                valueNotFoundText: '',
                width: 150,
                minChars: 1

                },

                '-',

              ],                
            bbar: pager1
            });

              Ext.getCmp('cboAnimal').addListener('select', function(combo, record, index){

                  grid1.getStore().baseParams['animal_id'] = record.get('id');
                  grid1.getStore().load();
                });






               var store = new Ext.data.JsonStore({
                proxy: new Ext.data.HttpProxy({
                        url: '/index.php/getContent'

                    }),
                    root: 'data',
                    pruneModifiedRecords: true,
                    totalProperty: 'total',
                    baseParams: {limit: 25},
                    autoLoad: {params: {start: 0}},
                    fields: ['id','animals'],
                    sortInfo: {field:'id', direction:'ASC'}

            });


                var grid = new Ext.grid.EditorGridPanel({
                id: 'maingrid',
                store: store,

                cm: cm,

                width: 785.5,
                anchor: '100%',
                height: 700,

                frame: true,
                loadMask: true,
                waitMsg: 'Loading...',
                clicksToEdit: 1,
                bbar: pager
            });

Try this and let me know the result... 试试这个,让我知道结果...

// instead of baseParam try to use extraParams
grid1.getStore().proxy.extraParams = {'animal_id': record.get('id')}

Also, please write the error message or what you getting! 另外,请写下错误消息或您得到什么!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM