cmendez21
2 Oct 2008, 11:34 PM
Hi everyone just recently i'm starting to develop some apps that are companion of my main web application so i've discovered a curious thing about the dataview
if you don't define itemSelector an error is launched "TypeError: Undefined value" and also the stack has many errors on ExtAir.js and Ext-All.js generated by the initial error, so even if you don't define the selector on CSS it have to be on the code with something of value :-?
Just want to share this tip,may be useful to anyone
Here's a code sample
myStore = new Ext.data.Store({
sortInfo : { field:'id', direction:'ASC'},
reader: new Ext.data.JsonReader({
id: 'id',
fields: [{name:'id', type:'string'},
{name:'eventname', type:'string'},
{name:'starts', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''},
{name:'ends', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''},
{name:'completed', type:'int'}]
})
});
myStore.proxy= new Ext.sql.Proxy(myConn,'test_001','id',myStore);
myStore.load({
callback: function(){
// first time?
if(myStore.getCount() < 1){
alert ("Theres no data to display..." );
return false;
} else {
alert("there is (" + myStore.getCount() + ")");
torender = new Ext.DataView({
store :myStore,
tpl:templates.mytpl,
autoHeight:true,
multiSelect: false,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText: 'No Records...!'
});
torender.render('testtpldata');
}
},
scope: this
});
if you don't define itemSelector an error is launched "TypeError: Undefined value" and also the stack has many errors on ExtAir.js and Ext-All.js generated by the initial error, so even if you don't define the selector on CSS it have to be on the code with something of value :-?
Just want to share this tip,may be useful to anyone
Here's a code sample
myStore = new Ext.data.Store({
sortInfo : { field:'id', direction:'ASC'},
reader: new Ext.data.JsonReader({
id: 'id',
fields: [{name:'id', type:'string'},
{name:'eventname', type:'string'},
{name:'starts', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''},
{name:'ends', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''},
{name:'completed', type:'int'}]
})
});
myStore.proxy= new Ext.sql.Proxy(myConn,'test_001','id',myStore);
myStore.load({
callback: function(){
// first time?
if(myStore.getCount() < 1){
alert ("Theres no data to display..." );
return false;
} else {
alert("there is (" + myStore.getCount() + ")");
torender = new Ext.DataView({
store :myStore,
tpl:templates.mytpl,
autoHeight:true,
multiSelect: false,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText: 'No Records...!'
});
torender.render('testtpldata');
}
},
scope: this
});