or
<!-- Event Page !!! Inherit the layout just above for footer and header -->
<
div
data-role
=
"view"
data-layout
=
"overview-layout"
data-show
=
"initEvent"
id
=
"event"
>
<
div
data-role
=
"content"
class
=
"content"
>
<
div
id
=
"eventContent"
></
div
>
<
div
>
<
div
id
=
"friendsToInvite"
></
div
>
</
div
>
</
div
>
</
div
>
<
script
id
=
"friendsToInvite-template"
type
=
"text/x-kendo-template"
>
<
p
>#= name #</
p
>
<
div
style
=
"width: auto; height: 180px; background: url('https://graph.facebook.com/#= fbid #/picture?type=large') no-repeat center;"
></
div
>
<
p
><
button
>Invite</
button
><
button
>Dont show me again</
button
></
p
>
</
script
>
var
y = 3;
function
initEvent( e )
{
//Get the "Key" of the event, which is linked to the id somehow
var
key = e.view.params.key;
//Retrieve the event info from the cache with the key !
var
event = Event.retrieveFromKey( key );
// Append the template of the event upon the event info
var
template = Handlebars.compile( $(
'#eventTemplate'
).html() );
$(
'#eventContent'
).prepend( template( event ) );
//The next ones are about getting your friend list for this specific event based on the algo
// Generate an empty kendo Scroll View
var
friendsToInvite =
new
kendo.data.DataSource({
data: []
});
$(
"#friendsToInvite"
).kendoMobileScrollView(
{
dataSource: friendsToInvite,
template: $(
"#friendsToInvite-template"
).html(),
contentHeight: 300,
enablePager:
false
});
$.when( Event.getFriendsList( event.id ) ).done(
function
( friendsList )
{
if
( friendsList.length > 0 )
{
for
(
var
i = 0; i < y; i++ )
{
friendsToInvite.add( { name: friendsList[i][
"name"
], fbid: friendsList[i][
"fbid"
] } );
};
$(
"#friendsToInvite"
).data(
"kendoMobileScrollView"
).setDataSource(friendsToInvite);
// y++;
// console.log(y);
// if (y > 5) {
// console.log("refresh");
// console.log ( scrollview );
// $( "#friendsToInvite" ).data("kendoMobileScrollView").setDataSource(friendsToInvite);
// scrollview.refresh();
// $( "#friendsToInvite" ).empty();
// };
// console.log(friendsToInvite);
// $( "#friendsToInvite" ).kendoMobileScrollView(
// {
// dataSource: friendsToInvite,
// template: $( "#friendsToInvite-template" ).html(),
// contentHeight: 300,
// enablePager: false
// });
}
else
{
console.log(
"Got to be creative on this one ..."
)
}
});
}
bundles.Add(
new
ScriptBundle(
"~/bundles/kendo"
).Include(
"~/Scripts/kendo/kendo.all.min.js"
,
"~/Scripts/kendo/kendo.mobile.min.js"
,
"~/Scripts/kendo/kendo.aspnetmvc.min.js"
));
bundles.Add(new StyleBundle("~/Content/kendo/css").Include(
"~/Content/kendo/kendo.mobile.all.min.css",
"~/Content/kendo/kendo.common-bootstrap.min.css",
"~/Content/kendo/kendo.bootstrap.min.css"));
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/kendo/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/kendo")
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12 col-lg-8 col-centered"
style
=
"max-width:600px;"
>
<
div
data-role
=
"view"
>
@(Html.Kendo().MobileScrollView()
.Name("adRotator")
.DataSource(ds => ds.Read("GetAdRotatorImages", "Ads", new{id = Model.AdId}))
)
</
div
>
</
div
>
</
div
>
<
script
>
var app = new kendo.mobile.Application();
</
script
>