Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refresh a GridView in Extjs?

I am using a gridview which is binding data from datastore dynamically. I have two textbox to enter data into grid. On submit button click the textbox data I am adding to my datastore (no need to store in backend). Now I want to refresh my gridview with datastore.

My Code:

_createEmptyRecord: function () {

var emptyrecord = Ext.data.Record.create(["id", "name", "type"]);

        return new emptyrecord({
            formula_id: 1,
            name: Amit,
            type: anything
        });
    },


    _addValuetogrid: function () {
        var record = this._createEmptyRecord();
        this._store.insert(0, record);
    },
_refreshgrid: function()
{

this._grid._addValuetogrid();

},

Now how to refresh my Gridview ?

Please help me...

like image 395
Amit Avatar asked Mar 27 '12 12:03

Amit


2 Answers

Ext.grid.GridView has refresh() method.

this._grid.getView().refresh();
like image 96
Jan Míšek Avatar answered Oct 03 '22 08:10

Jan Míšek


I believe a refresh function similar to this (untested) will work for Extjs 4;

_refreshgrid: function()
    {
        this._grid.getActiveView().refresh(true);
    }
like image 39
Jon Smith Avatar answered Oct 03 '22 09:10

Jon Smith