View Full Version : Pass empty store as config. options for a gridpanel/listview

4 Oct 2010, 12:51 PM
Hi there,

I'm wondering how I can pass an empty store as config. option for a GridPanel or ListView. AFAIK, if you do not configure this option, you will get errors. I want to do this so I can populate the store later when some event is fired.

I'm trying:

var dummyData = [];
var emptyStore = new Ext.data.XmlStore({data: dummyData});

This is not working, throwing the "undefined is null or not an object".

Any ideas ?


5 Oct 2010, 3:20 AM
I suggest

var emptyStore = new Ext.data.XmlStore();

5 Oct 2010, 3:41 AM
Why can't you just supply a fully configured store - just not with data?

5 Oct 2010, 3:43 AM
exactly. Just load data at later point.

5 Oct 2010, 10:57 AM
Why can't you just supply a fully configured store - just not with data?

This is what I tried for the "empty" store:

var XMLReader = new Ext.data.XmlReader({ record: "ressource_details"},

var dummyStore = new Ext.data.Store({
reader: XMLReader });

That still errors out... I don't know what you mean exactly by "fully" configured store, as I don't need an url either data since this store will be populated from some other event.

cm is undefinedlen = cm.getColumnCount(), ext-all-debug.js (line 44188)this.manager is undefinedif(this.manager.bringToFront(this)){

5 Oct 2010, 11:16 PM
That error is not from the store! It is from a grid for which you didn't specify columns, cm or colModel.

6 Oct 2010, 6:14 AM
That is quite right. Stupid me. That's what I get for trying to be a tech support lv1/2 AND programmer at the same time...


6 Oct 2010, 11:43 AM
Hmm. Do you think that makes sense ? I'm trying to feed a GridPanel's store after a form has actioncomplete'd.

function onActionComplete(f, a) {
var resReader = new Ext.data.XmlReader({ record: 'ressource_details'},

var resData = resReader.readRecords(a.response.responseText);
var resStore = new Ext.data.Store({
reader: resReader,
proxy: new Ext.data.MemoryProxy(resData) //I understand this is what I have to use if I'm to provide data from a variable and not an URL


Ext.getCmp('resGrid').store = resStore; //the Grid's new store...

I do this as the GridPanel's data comes from a different node of the XML the FormPanel uses. The GridPanel is within that FormPanel. Problem is that resData has 0 items according to Firebug's watch. :(

6 Oct 2010, 10:48 PM
1. An XMLReader reads the responseXML and not the responseText.
2. You should use loadData() instead of using a MemoryProxy.
3. You can't set the store of a grid; you need to call reconfigure() for that.
4. You shouldn't change the store! Preconfigure the correct store in the grid and only call


7 Oct 2010, 5:59 AM
Wow. That one line of code fixed it all. I can't thank you enough for that. :)