PDA

View Full Version : list no index



ralf3000
27 Jul 2010, 3:59 AM
Hi,
I am trying to create a simple videoviewer app. I build a video Overview with the Ext.List.

First Question:
i can't get the index from the list-item is always "-1". Am I missing something?
(I solved this by storing the video id in the div id, but this is not really a good solution)

Second Question:
Is there a more elegant way to update the video data? Someone can give me a hint?

http://www.braitling.de/clients/sencha/app/testapp/

Thanks!

The relevant code:

Ext.regModel('Videos', {
fields: ['title','id']
});

var videoStore = new Ext.data.Store({
autoLoad: true,
proxy: {
url: 'http://vimeo.com/api/v2/channel/quaentchen/videos.json',
type: 'scripttag',
reader: 'json',
writer:'json',
},
model: 'Videos'
});

var navPanel = new Ext.List({
dock:'left',
title: 'Videos',
store:videoStore,
scroll: 'vertical',
tpl: '<tpl for="."><div class="videoItem" id={id} >{title}<span >VimeoId: {id}</span></div></tpl>',
singleSelect: true,
grouped: false,
indexBar: false,
itemselector:'div.videoItem',
ui:'light',
width:200,
});

navPanel.on('itemtap', function(list, index, item) {
alert("index: "+index+" \nitem: "+item+ "\nitemId: "+item.id );
/*var testRec=list.store.getAt(3)
alert(testRec.get('id'))*/
var currentId = item.id;
video.update({
id:currentId
});
});


var video = new Ext.Panel({
tpl: '<tpl for="."><video src="http://www.vimeo.com/play_redirect?clip_id={id}" autobuffer autoplay controls></video>myVideo</tpl>',
/*items: [{
height:360,
width:640,
xtype: 'video',
url: 'http://www.vimeo.com/play_redirect?clip_id=12892195',
poster: 'http://ats.vimeo.com/732/261/73226107_200.jpg'
}]*/
});