paulfilippi
24 Dec 2010, 4:59 AM
Hi there,
I have been trying to get that simple piece of code to work.
Ext.setup({
onReady: function() {
var shopStore = new Ext.data.Store({
model: new Ext.regModel('Shop', {
fields: [
{name: 'node_title', type: 'string'}
]
}),
proxy: {
type: 'ajax',
url: '/request.php',
reader: {
type: 'json',
root: '#data'
}
}
});
shopStore.load();
var shopList = new Ext.DataView({
store: shopStore,
tpl: new Ext.Template(
'<tpl for="."><div class="shop" id="{node_title}">{node_title}</div></tpl>'
),
fullscreen: true,
autoHeight:true,
multiSelect: true,
itemSelector:'div.shop',
emptyText: 'No shop to display'
});
}
});
It displays a one item list no matter how many items are returned by my "request.php" script.
Furtermore, this item does not display the 'node_title' field.
I just don't get it. Any idea what I did wrong?
Here is a sample of the json my request.php returns.
{ "#error": false, "#data": [ { "nid": "2", "node_revisions_body": "", "node_revisions_format": "1", "node_title": "Shop 1" }, { "nid": "3", "node_revisions_body": "", "node_revisions_format": "1", "node_title": "Shop 2" } ] }
Thanks in advance!
I have been trying to get that simple piece of code to work.
Ext.setup({
onReady: function() {
var shopStore = new Ext.data.Store({
model: new Ext.regModel('Shop', {
fields: [
{name: 'node_title', type: 'string'}
]
}),
proxy: {
type: 'ajax',
url: '/request.php',
reader: {
type: 'json',
root: '#data'
}
}
});
shopStore.load();
var shopList = new Ext.DataView({
store: shopStore,
tpl: new Ext.Template(
'<tpl for="."><div class="shop" id="{node_title}">{node_title}</div></tpl>'
),
fullscreen: true,
autoHeight:true,
multiSelect: true,
itemSelector:'div.shop',
emptyText: 'No shop to display'
});
}
});
It displays a one item list no matter how many items are returned by my "request.php" script.
Furtermore, this item does not display the 'node_title' field.
I just don't get it. Any idea what I did wrong?
Here is a sample of the json my request.php returns.
{ "#error": false, "#data": [ { "nid": "2", "node_revisions_body": "", "node_revisions_format": "1", "node_title": "Shop 1" }, { "nid": "3", "node_revisions_body": "", "node_revisions_format": "1", "node_title": "Shop 2" } ] }
Thanks in advance!