PDA

View Full Version : Not able to view store in the Dataview



janrn
29 Mar 2012, 8:22 AM
I am trying out a simple dataview code, but the store is not displayed in the dataview.
33310
Here is the code
::
Ext.Loader.setConfig({ enabled: true });
Ext.require([
'Ext.data.*',
'Ext.util.*',
'Ext.panel',
'Ext.view.View'
]);
Ext.onReady(function () {
Ext.define('entryModel',
{
extend: 'Ext.data.Model',
fields: [{ name: 'layer', type: 'string' }, { name: 'date', type: 'date' }, { name: 'entry', type: 'string'}]
// hasMany: { model: 'accountModel', name: 'accounts' }
});

var store1 = Ext.create('Ext.data.Store', {
model: 'entryModel',
data: [
{ layer: 'GAAP', date: '2010-01-15 00:00:00', entry: 'AJE1' },
{ layer: 'StateTax', date: '2010-01-15 00:00:00', entry: 'AJE2'}
],
autoLoad: true

});
var tpl = new Ext.XTemplate(
'<tpl for ".">',
'<p class="item">layer = {layer} </p>',
'</tpl>'
);
var dataView = new Ext.DataView({
store: store1,
tpl: tpl,
autoHeight: true,
multiSelect: true,
overClass: 'x-view-over',
itemSelector: 'p.item',
emptyText: 'No items to display'
});
Ext.create('Ext.Panel', {
id: 'images-view',
frame: true,
collapsible: true,
width: 535,
renderTo: 'dataview-example',
items: [dataView],
title: 'Simple DataView '
});
});

börn
29 Mar 2012, 8:27 AM
You may change your dataview to a simple grid with some columns to see if its a problem with the store or with the dataview or the template...

börn
29 Mar 2012, 8:30 AM
Hm .. you also should add id values to your data array...