Question

This is a bit of a blast from the past, but anyway...

I have a grid, that loads from a store, with a rowselection model, and some buttons etc...

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)

Now My question is...

How do I add a row to this grid without actually adding it to the store?

I want to do this so i can violate the column model ( eg I wanna add another row that has some textual info in it, and a hyperlink, which isn't gonna fit in my 4 column wide grid )

Can I access it as a dataview or something?

this.store.on('load',function(store,records,e){
        doWhat()
        //debugger;
    },this);
};
Was it helpful?

Solution 2

Guess you can over write the view, inside the 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)

OTHER TIPS

Iamagonnasay no :) The grid has a well defined column model and the view is bound to the store - the data in the store to be exact. So ... no you can't insert a row in a grid that does not fit the columns defined in the grid. What you can do is expand the rowbody of an individual row and insert some random HTML in the expanded section of a row. Lookup RowBody plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top