0

これは過去からのちょっとした爆発ですが、とにかく...

私は、行選択モデルといくつかのボタンなどを備えた、ストアからロードするグリッドを持っています...

MyGrid = function(config){
    var config = Ext.apply({},config,{
    cm:'rowselection',
    store:new Ext.data.Store({
        ajax:true,
        url:'someUrl'
    })//thumbsucked config, this is prolly totally wrong
    });

    MyGrid.superclass.constructor.call(this, config);
}
Ext.extend(MyGrid,Extx.grid.GridPanel)

今私の質問は...

実際にストアに追加せずに、このグリッドに行を追加するにはどうすればよいですか?

これを実行して、列モデルに違反できるようにします(たとえば、テキスト情報を含む別の行と、4列幅のグリッドに収まらないハイパーリンクを追加したい)。

データビューなどとしてアクセスできますか?

this.store.on('load',function(store,records,e){
        doWhat()
        //debugger;
    },this);
};
4

2 に答える 2

1

Iamagonnasay no :)グリッドには明確に定義された列モデルがあり、ビューはストアにバインドされています。正確にはストア内のデータです。したがって...いいえ、グリッドで定義された列に適合しない行をグリッドに挿入することはできません。できることは、個々の行の行本体を展開し、行の展開されたセクションにランダムなHTMLを挿入することです。RowBodyプラグインを検索します。

于 2012-06-05T21:44:41.690 に答える
0

Dom内でビューを上書きできると思います。

this.store.on('load',function(store,records,e){
        rowTpl = new Ext.Template(
            '<div class="x-grid3-row x-grid3-row-last">',
                '<table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
                    '<tbody><tr>{cellTpl}</tr></tbody>',
                '</table>',
            '</div>'
        );

        cellTpl = new Ext.Template(
            '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}">',
            '<div class="x-grid3-cell-inner x-grid3-col-{id}"> Hello World</div>',
            "</td>"
        );
        cellTpl.compile();

        html=rowTpl.apply({
            tstyle: 'width:' + this.view.getTotalWidth() + ';',
            cellTpl: cellTpl.compile().html
        });
        Ext.DomHelper.insertHtml('beforeEnd', this.view.mainBody.dom, html);
    },this)
于 2012-06-06T07:59:02.267 に答える