PDA

View Full Version : DataView has problem with ArrayStore



spiderman123
2 Nov 2009, 4:48 PM
hi everyone,

i ve try to create a panel with dataview. But it dit not work for me. Here is my code:



var myPanel = new Ext.Panel ({
id:config.id,
region:'west',
border:false,
collapsible: true,
split:true,
layout:'fit',
cls: 'buttonbar-view',
frame:true,
width:200,
//collapseMode: "mini",
title:'Simple DataView',
items:buttonNodes
});

var buttonData = [['co_person','person.png','Person','Person']];

var store = new Ext.data.ArrayStore({
fields: [
'id',
'url',
'displayText',
'tooltipText'
],
data:buttonData
});

var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="thumb-wrap" id="wrap-{id}">',
'<div class="thumb"><img id="thumb-{id}" src="{url}" title="{tooltipText}"></div>',
'<span class="x-editable">{displayText}</span></div>',
'</tpl>',
'<div class="x-clear"></div>'
);

var buttonNodes = new Ext.DataView({
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
cls: 'thumb-view',
emptyText: 'No images to display',
multiSelect:true,
store: store,
tpl: tpl
});

Pls help me!!!!

Thx

evant
2 Nov 2009, 5:16 PM
You're doing it in the wronger order. You assign buttonNodes as an item before you even create it!

spiderman123
3 Nov 2009, 12:10 AM
You're doing it in the wronger order. You assign buttonNodes as an item before you even create it!

Evant, you're right. Thx for your help!