DracisFL
21 Feb 2012, 9:22 AM
Hello,
http://edspencer.net/2012/02/building-a-data-driven-image-carousel-with-sencha-touch-2.html
I'm trying to build in designer for practice, this demo that Ed Spencer wrote for Sencha Touch 2 (see link). Problem is that the image is buried within the content that I'm trying to display in a carousel. Ed wrote a function in the model to get around that. So my Question, is how can I do this using designer, or can I ?
Ext.define('apod.model.Picture', {
extend: 'Ext.data.Model',
config: {
fields: [
'id', 'title', 'link', 'author', 'content',
{
name: 'image',
type: 'string',
convert: function(value, record) {
var content = record.get('content'),
regex = /img src=\"([a-zA-Z0-9\_\.\/\:]*)\"/,
match = content.match(regex),
src = match[1];
if (src != "" && !src.match(/\.gif$/)) {
src = "http://src.sencha.io/screen.width/" + src;
}
return src;
}
}
]
}
});
Any guidance appreciated.. thx..
http://edspencer.net/2012/02/building-a-data-driven-image-carousel-with-sencha-touch-2.html
I'm trying to build in designer for practice, this demo that Ed Spencer wrote for Sencha Touch 2 (see link). Problem is that the image is buried within the content that I'm trying to display in a carousel. Ed wrote a function in the model to get around that. So my Question, is how can I do this using designer, or can I ?
Ext.define('apod.model.Picture', {
extend: 'Ext.data.Model',
config: {
fields: [
'id', 'title', 'link', 'author', 'content',
{
name: 'image',
type: 'string',
convert: function(value, record) {
var content = record.get('content'),
regex = /img src=\"([a-zA-Z0-9\_\.\/\:]*)\"/,
match = content.match(regex),
src = match[1];
if (src != "" && !src.match(/\.gif$/)) {
src = "http://src.sencha.io/screen.width/" + src;
}
return src;
}
}
]
}
});
Any guidance appreciated.. thx..