I've got my little asp.net mvc app working as expected, however I'm building the JSON incorrectly.
Here's my current way of building a JSON object for consumption within Sencha
// note: this is using a RAZOR / C# foreach loop to build a JSON string
var videosToShow = [
@foreach (Web.Models.VideoListViewModel video in Model){
@Html.Raw("{ id: " + @video.id + ",")
@Html.Raw(" title: \"" + @video.title + "\" },")
}
];
Then I have a Sencha Template
videoTpl = new Ext.XTemplate([
'<tpl for=".">',
'<div>',
'<iframe src="http://player.vimeo.com/video/{id}?title=0&byline=0&portrait=0&color=80ceff&fullscreen=1" ',
'width="' + screenWidth + '" ',
'height="' + screenHeight + '" ',
'frameborder="0">',
'</iframe>',
' {title}',
'</div>',
'</tpl>'
]);
as well as a video panel
videoPanel = new Ext.Panel({
title: "Videos",
tpl: videoTpl,
iconCls: "tv",
dockedItems: [{ xtype: "toolbar", title: "Videos"}],
scroll: "vertical"
});
and my root TabPanel
rootPanel = new Ext.TabPanel({
fullscreen: true,
layout: 'card',
region: 'center',
items: [videoPanel, biblePanel, aboutPanel, helpPanel, morePanel],
tabBar: { dock: 'bottom' }
});
videoPanel.update(videosToShow);
The bottom line here is that the above works just fine. I just don't like the internal JSON string, I'd much rather send the JSON from a URL.
It's probably something simple that I'm missing, but any influence will be greatly appreciated.