Ext.grid.ColumnModel显示空白

时间:2014-01-09 10:03:56

标签: javascript extjs

嗨这是我的extjs代码我添加了一些参数但是当我运行代码时o / p显示为空白

    Ext.onReady(function(){
    Ext.QuickTips.init();
    PresidentsDataStore = new Ext.data.Store({
    id: 'PresidentsDataStore',
    proxy: new Ext.data.HttpProxy({
    url: 'database.php',       
    method: 'POST'
    }),
    baseParams:{task: "LISTING"},  
    reader: new Ext.data.JsonReader({   

    root: 'results',
    totalProperty: 'total',
    id: 'id'
    },[ 
    {name: 'IDpresident', type: 'int', mapping: 'IDpresident'},
    {name: 'FirstName', type: 'string', mapping: 'firstname'},
    {name: 'LastName', type: 'string', mapping: 'lastname'},
    {name: 'IDparty', type: 'int', mapping: 'IDparty'},
    {name: 'PartyName', type: 'string', mapping: 'name'},         
    ]),
    sortInfo:{field: 'IDpresident', direction: "ASC"}
    });

    PresidentsColumnModel = new Ext.grid.ColumnModel(
    [{
    header: '#',
    readOnly: true,
    dataIndex: 'IDpresident', 
    width: 50,
    hidden: false
    },{
    header: 'First Name',
    dataIndex: 'FirstName',
    width: 150,
    editor: new Ext.form.TextField({   
    allowBlank: false,
    maxLength: 20,
    maskRe: /([a-zA-Z0-9\s]+)$/   // alphanumeric + spaces allowed
    })
    },{
    header: 'Last Name',
    dataIndex: 'LastName',
    width: 150,
    editor: new Ext.form.TextField({
    allowBlank: false,
    maxLength: 20,
    maskRe: /([a-zA-Z0-9\s]+)$/
    })
    },{
    header: 'ID party',
    readOnly: true,
    dataIndex: 'IDparty',
    width: 50,
    hidden: true                      // we don't necessarily want to see this...
    },{
    header: 'Party',
    dataIndex: 'PartyName',
    width: 150,
    readOnly: true
    }]
    );
    PresidentsColumnModel.defaultSortable= true;
    PresidentListingEditorGrid =  new Ext.grid.EditorGridPanel({
    id: 'PresidentListingEditorGrid',
    store: PresidentsDataStore,     // the datastore is defined here
    cm: PresidentsColumnModel,      // the columnmodel is defined here
    enableColLock:false,
    clicksToEdit:1,
    selModel: new Ext.grid.RowSelectionModel({singleSelect:true})
    });

    PresidentListingWindow = new Ext.Window({
    id: 'PresidentListingWindow',
    title: 'The Presidents of the USA',
    closable:true,
    width:700,
    height:350,
    plain:true,
    layout: 'fit',
    items: PresidentListingEditorGrid  // We'll just put the grid in for now...
    }); 
    PresidentsDataStore.load();      // Load the data
    PresidentListingWindow.show(); // Display our window 
    });

这是我的带有硬编码值的database.php文件。

    <?php
    $cust[0]['IDpresident']=10;
    $cust[0]['FirstName']='vinod';
    $cust[0]['LastName']='kachare';
    $cust[0]['IDparty']=123;
    $cust[0]['PartyName']='xyz';
    echo json_encode($cust); 
    ?>

你可以告诉我,php文件中的问题在哪里,因为o / p似乎是空白的

0 个答案:

没有答案