我是Sencha ExtJS经典游戏的初学者!
我需要将内容更改为dataview itemTpl。
这是我来自jsonstore的数据:
{
success: true,
items: {
idTipoActividad: 1,
Ejercicios: [{
idimgCorrect: 1,
nameAudio: 'brother-in-law',
images: [{
id: 1,
filename: 'https://www.abc.es/Media/201308/01/1--644x362.jpg'
}, {
id: 2,
filename: 'https://www.abc.es/Media/201308/01/1--644x362.jpg'
}, {
id: 3,
filename: 'https://www.abc.es/Media/201308/01/1--644x362.jpg'
}, {
id: 4,
filename: 'https://www.abc.es/Media/201308/01/1--644x362.jpg'
}]
}, {
idimgCorrect: 2,
nameAudio: 'Home',
images: [{
id: 1,
filename: 'https://upload.wikimedia.org/wikipedia/commons/0/0d/SEAT_600_SIAM_2008.JPG'
}, {
id: 2,
filename: 'https://upload.wikimedia.org/wikipedia/commons/0/0d/SEAT_600_SIAM_2008.JPG'
}, {
id: 3,
filename: 'https://upload.wikimedia.org/wikipedia/commons/0/0d/SEAT_600_SIAM_2008.JPG'
}, {
id: 4,
filename: 'https://upload.wikimedia.org/wikipedia/commons/0/0d/SEAT_600_SIAM_2008.JPG'
}]
}]
}
}
Ejercicios数组应通过单击按钮更改并显示在itemTpl中 这是我的fiddle
答案 0 :(得分:1)
使用tpl
代替itemTpl
,并将以下功能附加到dataview
:
setTemplate: function (template, itemSelector) {
this.tpl = template;
this.itemSelector = itemSelector;
this.refresh();
}
并在您的onBtnNextClick1
函数中使用它,如下所示:
refs.viewImages.setTemplate(tpl, 'div.container');
注意:请检查fiddle中的AudioImagen3.js
和MyWindow3ViewController4.js
了解详细信息。 (我也更正了一些代码。)
希望这会帮助/指导您。