EXTJS 3.0 자료 컨트롤의combo 사용법

5902 단어 ExtJs
EXTJS combo 컨트롤:
1.store 먼저 정의
// 

var comboData_ReleasYear = [

     ['0', '2010'],

     ['1', '2011'],

     ['2', '2013'],

     ['3', '2014']

];

2. combo 컨트롤 정의
{

            layout: 'form',

            labelWidth: 50,

            width: 260,

            items: [{

                xtype: 'combo', name: 'ReleasYear', allowBlank: false,

                fieldLabel: ' ', width: 150,

                store: new Ext.data.SimpleStore({

                    fields: ['Id', 'Name'],

                    data: comboData_ReleasYear

                }),

                valueField: "Id",

                displayField: "Name",

                mode: 'local',

                editable: false,

                triggerAction: 'all',

                allowBlank: false,

                autoload: true,

                listeners: {

                    'select': function (combo, record, index) {                   

                        var ReleasYear = PKUPanelForm.form.findField('ReleasYear').getRawValue();

                        if (ItemStorePKU.getCount() == 0) {

                            ItemStorePKU.insert(0, new ItemStorePKU.recordType({ ReleasYear: ReleasYear }));// 

                        } else {

                            for (var i = 0; i < ItemStorePKU.getCount() ; i++) {

                                ItemStorePKU.insert(i, new ItemStorePKU.recordType({ ReleasYear: ReleasYear }));//   

                            }

                        }

                    }

                }

            }

            ]

        }

좋은 웹페이지 즐겨찾기