没有获取Ext JS表单中的数据

时间:2013-02-28 09:42:17

标签: extjs formpanel

function open() {
    var req_spec_store = new Ext.data.SimpleStore({
        url: 'mngr_req_ajx.php',
        fields: ['value', 'text'],
        data: [
            ['Android', 'Android'],
            ['iPhone', 'iPhone'],
            ['iPhone2', 'iPhone2'],
            ['iPhone3', 'iPhone3']
        ]
    });
    req_spec_store.load({
        params: {
            todo: 'Get_Req_Spec'
        }
    });


    var menuWin = new Window('menuWindow', {
        title: "Create Data",
        width: 980,
        height: 340,
        draggable: true,
        destroyOnClose: true,
        hideEffect: Element.hide,
        showEffect: Element.show,
        minimizable: false,
        maximizable: false,
        closable: true,
        resizable: false,
        items: [new Ext.FormPanel({
            renderTo: 'r_sp',
            id: 'mngReqForm',
            layout: 'form',
            height: innerHeight - 250,
            width: innerWidth - 50,
            frame: true,
            destroyOnClose: true,
            defaults: {
                msgTarget: 'side',
                labelSeparator: ''
            },
            labelAlign: 'right',
            items: [{
                xtype: 'combo',
                fieldLabel: 'Data Entry ',
                store: req_spec_store,
                displayField: 'text',
                valueField: 'value',
                mode: 'local',
                emptyText: 'Select Entry...',
                triggerAction: 'all',
                name: 'specId2',
                id: 'specId2',
                hiddenName: 'specIdHid',
                width: 150,
                forceSelection: false,
                editable: false,
                selectOnFocus: true
            }]
        })]
    });
}
点击按钮打开

窗口。在窗口内,有表格面板。哪个有一个组合类型元素。我使用ajax调用PHP,直接在Ext.onReady()上执行操作时成功获取数据,但是在窗口打开的情况下却没有。

1 个答案:

答案 0 :(得分:1)

商店的数据应该是JSON(也是{}而不是[] =

data : [ {value:'Android', text:'Android' }, ... ]