最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to refresh a GridView in Extjs? - Stack Overflow

programmeradmin0浏览0评论

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...

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...

Share Improve this question edited Mar 27, 2012 at 12:31 T.J. Crowder 1.1m199 gold badges2k silver badges1.9k bronze badges asked Mar 27, 2012 at 12:25 AmitAmit 1152 gold badges2 silver badges4 bronze badges 2
  • 6 Capslock broken? – Sirko Commented Mar 27, 2012 at 12:27
  • 4 PLEASE DON'T SHOUT (I've fixed it for you on this occasion) – T.J. Crowder Commented Mar 27, 2012 at 12:30
Add a comment  | 

2 Answers 2

Reset to default 13

Ext.grid.GridView has refresh() method.

this._grid.getView().refresh();

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

_refreshgrid: function()
    {
        this._grid.getActiveView().refresh(true);
    }
发布评论

评论列表(0)

  1. 暂无评论