
Originally Posted by
bluehipy
Show us the code, to see how you did it.
hi bluehipy,
thanks for the reply,
this is the end result that i want to achieve,
dataitem layout.png
here is my custom dataitem:
Code:
Ext.define('newapp.custom.DIThumbnail', {
extend: 'Ext.dataview.component.DataItem'
, xtype: 'dithumbnail'
, require: [
'Ext.Img'
, 'newapp.custom.DIThumbnailDetails'
]
, config: {
cls: 'dithumbnail'
, layout: 'hbox'
, image: {
cls: 'dithumbnail_image'
}
, details: {
cls: 'dithumbnail_details'
}
, dataMap: {
getImage: {
setSrc: 'image' //setSrc of Ext.Img
}
, getDetails: {
setThumbnailTitle: 'title'
, setThumbnailButton: 'unit'
, setText1: 'priceLow'
, setText2: 'priceHigh'
}
}
}
, applyImage: function (config) {
return Ext.factory(config, Ext.Img, this.getImage());
}
, updateImage: function (newImage, oldImage) {
if (newImage) { this.add(newImage); }
if (oldImage) { this.remove(oldImage); }
}
, applyDetails: function (config) {
return Ext.factory(config, newapp.custom.DIThumbnailDetails, this.getDetails());
}
, updateDetails: function (newDetails, oldDetails) {
if (newDetails) { this.add(newDetails); }
if (oldDetails) { this.add(oldDetails); }
}
});
here is the custom class for the details in the dataitem:
Code:
Ext.define('newapp.custom.DIThumbnailDetails', {
extend: 'Ext.Container'
, xtype: 'DIThumbnailDetails'
, requires: [
'Ext.field.Checkbox'
]
, config: {
thumbnailTitle: null
, thumbnailButton: null
, text1: null
, text2: null
, items: [
{
xtype: 'component'
, cls: 'dithumbnail_details_title'
}
, {
xtype: 'button'
, ui: 'action-round'
, cls: 'dithumbnai_detailsl_button'
}
, {
xtype: 'component'
, cls: 'dithumbnail_details_text'
}
, {
xtype: 'component'
, cls: 'dithumbnail_details_text'
}
, {
xtype: 'checboxfield'
, cls: 'dithumbnail_details_checkbox'
}
]
}
, setThumbnailTitle: function (title) {
//need to figure out some way to get component by css class
this.getThumbnailTitle().setHtml(title);
}
, setThumbnailButton: function (text) {
//need to figure out some way to get component by css class
this.getThumbnailButton().setText(text);
}
, setText1: function (text) {
//need to figure out some way to get component by css class
this.getText1().setHtml(text);
}
, setText2: function (text) {
//need to figure out some way to get component by css class
this.getText2().setHtml(text);
}
});