t800t8
30 Sep 2009, 2:11 AM
I set up the DataView as below
this.selectorView = new Ext.DataView({
emptyText: 'No themes to display',
itemSelector: '.themes-list-item', // this one must be set to access to view item
trackOver: true,
tpl: new Ext.XTemplate(
'<tpl for=".">',
'<div class="themes-list-item">{id} - {name} - {state} <button id="details-theme-{id}" style="display: none">Details</button> <button id="remove-theme-{id}" style="display: none">Remove</button></div>',
'</tpl>',
'<div class="x-clear"></div>'
),
listeners: {
'click': SpatialMap.Function.bind(function(view, index, item, evt) {
var target = evt.getTarget();
this.currentThemeIndex = index;
if (target.tagName == 'BUTTON') {
if (target.id.startsWith('details-theme-')) {
this.showDetailsPanel();
}
if (target.id.startsWith('remove-theme-')) {
Ext.Msg.confirm('Warning', 'Are you sure to remove this theme?', SpatialMap.Function.bind(function(btn, text) {
if (btn == 'yes') {
this.selectorView.store.removeAt(index);
}
}, this));
}
}
}, this),
'mouseenter': this.onMouseEnterDataViewItem,
'mouseleave': this.onMouseLeaveDataViewItem
}
});then bindStore
this.selectorView.bindStore(new Ext.data.JsonStore({
root: 'themes',
url: 'themes-test-data.html',
autoLoad: true,
idProperty: 'id',
fields: this.recordModel
}));
Firebug shows me an error "el is undefined" at ext-all-debug.js (line 38305)
But if I setup the store as DataView's config option, I didn't see the error.
Is it ExtJS's bug? Or do I miss something?
this.selectorView = new Ext.DataView({
emptyText: 'No themes to display',
itemSelector: '.themes-list-item', // this one must be set to access to view item
trackOver: true,
tpl: new Ext.XTemplate(
'<tpl for=".">',
'<div class="themes-list-item">{id} - {name} - {state} <button id="details-theme-{id}" style="display: none">Details</button> <button id="remove-theme-{id}" style="display: none">Remove</button></div>',
'</tpl>',
'<div class="x-clear"></div>'
),
listeners: {
'click': SpatialMap.Function.bind(function(view, index, item, evt) {
var target = evt.getTarget();
this.currentThemeIndex = index;
if (target.tagName == 'BUTTON') {
if (target.id.startsWith('details-theme-')) {
this.showDetailsPanel();
}
if (target.id.startsWith('remove-theme-')) {
Ext.Msg.confirm('Warning', 'Are you sure to remove this theme?', SpatialMap.Function.bind(function(btn, text) {
if (btn == 'yes') {
this.selectorView.store.removeAt(index);
}
}, this));
}
}
}, this),
'mouseenter': this.onMouseEnterDataViewItem,
'mouseleave': this.onMouseLeaveDataViewItem
}
});then bindStore
this.selectorView.bindStore(new Ext.data.JsonStore({
root: 'themes',
url: 'themes-test-data.html',
autoLoad: true,
idProperty: 'id',
fields: this.recordModel
}));
Firebug shows me an error "el is undefined" at ext-all-debug.js (line 38305)
But if I setup the store as DataView's config option, I didn't see the error.
Is it ExtJS's bug? Or do I miss something?