+ -
当前位置:首页 → 问答吧 → GridPanel renderTo 问题

GridPanel renderTo 问题

时间:2011-01-17

来源:互联网

有一个页面 引入了一段JS 。
页面:***.jsp
JScript code

Ext.onReady(function(){

})

<div id="publicDiv"></div>

 
js:**.js
JScript code

var grid = new Ext.grid.GridPanel({
        store: store,
        renderTo:'publicDiv',     // [color=#FF0000]指向的时候报H IS NULL 这是为什么。。[/color]
        columns: [
            {id:'company',header: "Company", width: 160, sortable: true, dataIndex: 'company'},
            {header: "Price", width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
            {header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},
            {header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
            {header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
        ],
        stripeRows: true,
        autoExpandColumn: 'company',
        height:350,
        width:600,
        title:'Array Grid'
        
    });




望解答。 谢谢了。。

作者: greatmind829   发布时间: 2011-01-17

要看你提供的数据store对不对了。

作者: licip   发布时间: 2011-01-17

代码方面应该没什么问题
你是这样写的吗?
JScript code

Ext.onReady(function(){
var grid = new Ext.grid.GridPanel({
        store: store,
        renderTo:'publicDiv',     
        columns: [
            {id:'company',header: "Company", width: 160, sortable: true, dataIndex: 'company'},
            {header: "Price", width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
            {header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},
            {header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
            {header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
        ],
        stripeRows: true,
        autoExpandColumn: 'company',
        height:350,
        width:600,
        title:'Array Grid'
        
    });


})





作者: kc8886   发布时间: 2011-01-17