View Full Version : Reload a store from a grid

7 Mar 2011, 8:21 AM
I am just trying to project its own ExtJS.
I currently have the problem that I want the grid and the store of the grid reload or refresh after saving.

I can not find the right code to function in the success of the ajax requests to reload the grid or the store.

ich versuche mich gerade an einem eigenen extJS Projekt.
Im Moment habe ich das Problem, das ich das Grid bzw. den Store des Grids nach dem Speichern reloaden bzw. refreshen will.

Ich finde nicht den richtigen Code um in der success Funktion des AjaxRequests das Grid bzw. den store zu reloaden.

Hier ist der Code:

<script type="text/javascript">

var Grid = Ext.extend(Ext.grid.EditorGridPanel, {
title: 'Attribute der Kategorie', // Bezeichnung
id: 'Grid',
stripeRows:true, // Zeilen unterschiedlich einfaerben
region: 'center',
boxMinHeight: 200,
autoHeight: true,
initComponent: function() {
Datenquelle definieren
this.store = new Ext.data.Store({
url: '{url action=getAttributes}',
autoLoad: true,
storeId: 'attributesStore',
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'count',

fields: [
Spalten definieren
this.columns = [
xtype: 'gridcolumn',
dataIndex: 'id',
header: 'ID',
sortable: false,
width: 40,
hidden: false
xtype: 'gridcolumn',
dataIndex: 'attr_id',
header: 'AttributeID',
sortable: false,
width: 70,
hidden: false
xtype: 'gridcolumn',
dataIndex: 'categoryID',
header: 'CategoryID',
sortable: false,
width: 70,
hidden: false
xtype: 'gridcolumn',
dataIndex: 'name',
header: 'Bezeichnung',
sortable: false,
width: 250
xtype: 'gridcolumn',
dataIndex: 'state',
header: 'Status',
sortable: false,
width: 150,
editor: {
xtype: "combo",
typeAhead: true,
lazyRender: true,
listClass: "x-combo-list-small",
[ "0" , "Nicht anzeigen" ], //the value at index 0 is
//assumed to be the combo value
[ "1" , "Dropdown" ], //the value at index 1 is
//assumed to be the combo text
[ "2" , "Slider" ],

[ "3" , "Boxen" ]

this.buttons = [{
text: 'Speichern',
handler: function(){
var data = [];
url: '{url module=backend controller=FinderAdmin action=setAttributes}',
params: { data: Ext.encode(data)},
success: function(){
/*if(success == true){
Ext.Msg.alert('Insert/Update','Daten sind angekommen');
Ext.Msg.alert('Insert/Update','Keine Daten versendet!');
Ext.Msg.alert('Insert/Update','Daten sind angekommen');
failure: function(){
Ext.Msg.alert('Insert/Update','Nichts angekommen');


Test.FinderAdmin.Grid = Grid;
Can erverybody help me?

8 Mar 2011, 3:58 AM
Can everybody help me?

8 Mar 2011, 4:06 AM
What error message are you getting?

Have you tried adding scope: this to the request's parameters?

Also, you could use the Ext.StoreMgr singleton to reload the store:


8 Mar 2011, 4:40 AM
Hello Fay,

thank you for your help.

My error Message are "... is not a function"

Thanks again for your good tip

Your tip works fine

8 Mar 2011, 4:46 AM
Is that the full message? I'm guess that it's "...this.getStore() is not a function" ??

Did you add scope, or try Ext.StoreMgr?

8 Mar 2011, 5:54 AM
you must use something like:

Ext.getCmp('Your Grid ID').getStore().load();

or reload() never mind...
becouse in that place of your code "this" is NOT your Grid!

8 Mar 2011, 6:25 AM
I use the Store Manager to make it work right away. Thanks for your help!
@emils ... "this" is probably at this point my Button
I have used this:

Ext.getCmp('attributesGrid').getStore().reload();Why does not it?

Ext.getCmp ('Your ID Grid') getstore () load ()..;
as well as:
Ext.getCmp ('Your ID Grid') getstore () reload ()..;

The store will be loaded not new!
Only with the Store Manager everything works.

8 Mar 2011, 6:36 AM
well. .. Once you know that "this" is your button, be remembered that this.getStore () will return the error :)