PDA

View Full Version : Empty ListView, throwing an error.



drunkmoose
24 Mar 2011, 7:15 AM
Hi guys,

I'm trying to create an empty ListView, the same way I do for a GridPanel which is assign a configured store, with no data but for the ListView, it's throwing an error

Uncaught TypeError: Cannot read property 'id' of undefined (ext-all-debug.js:42382)

Here's the code for the store:


var selectedListsStore = new Ext.data.ArrayStore({
fields: ["display_name"],
storeId: "selectedListsStore",
idIndex: 0
});

And there ListView:


{
xtype: "listview",
width: 175,
height: 200,
id: "selectedLists",
store: selectedListsStore,
columns: [{header: "Name", dataIndex: "display_name", width:200}]
}

The weird thing is that everything works as expected. I can add records to the store(listView) fine but it's just throwing that nasty error I want to get rid of.

Maybe I can add the background of the list is not white but rather, same color as the Panel's BG color.

Any ideas ?

Thx.

EDIT: For some reason, the store seems problematic. I can't call its load() function without getting Uncaught TypeError: Cannot call method 'request' of undefined

29 Mar 2011, 4:30 AM
Is the store to be loaded remotely or locally?

drunkmoose
30 Mar 2011, 6:54 AM
Locally. But I used a MemoryProxy and it worked fine

This is the store:


var selectedListsStore = new Ext.data.Store({
idProperty: "id",
proxy: new Ext.data.MemoryProxy([]),
storeId: "selectedListsStore",
reader: new Ext.data.ArrayReader
(
{
idIndex: 0
},
["id", "display_name"]
)
});

With that, I get no errors using the load() method anymore. :)