or
(
function
() {
define([
'jquery'
,
'amplify'
,
'modules/tools'
,
'k/kendo.router.min'
,
'k/kendo.view.min'
,
'k/cultures/kendo.culture.fr-CA.min'
,
'k/cultures/kendo.culture.en-CA.min'
],
function
($, amplify, tools) {
(
function
() {
define([
'jquery'
,
'amplify'
,
'modules/tools'
,
'modules/date'
,
'k/kendo.dataviz'
,
'k/cultures/kendo.culture.fr-CA.min'
,
'k/cultures/kendo.culture.en-CA.min'
],
function
($, amplify, tools) {
<
div
data-role
=
"view"
data-layout
=
"mobile-tabstrip"
id
=
"tabstrip-contentr"
data-show
=
"initcontent"
>
<
div
class
=
"content"
>
<
div
id
=
"cntpagehtml"
></
div
>
<
div
data-role
=
"scrollview"
data-autobind
=
"false"
id
=
"my-scrollview"
data-template
=
"scrollview-binding-template"
data-enable-pager
=
"true"
>
</
div
>
<
script
id
=
"scrollview-binding-template"
type
=
"text/x-kendo-template"
>
<
div
style
=
"width:300px;"
>
<
div
>
<
img
src
=
"/webimages/gallery/#: Image #"
class
=
"slider"
/></
div
>
<
div
class
=
"title"
>#= Caption #</
div
>
</
div
>
</
script
>
</
div
>
</
div
>
function
GetGallery(sectionid) {
var
_GalleryDS =
new
kendo.data.DataSource({
transport: {
read: {
url:
"mobiledata.asmx/GetGallery"
,
dataType:
"json"
,
type:
"POST"
,
data: { SectionID: sectionid },
contentType:
"application/json; charset=utf-8"
},
parameterMap:
function
(data, operation) {
data = $.extend({}, data);
return
JSON.stringify(data);
}
},
serverPaging:
true
,
pageSize: 30,
schema: {
data:
"d[0].Items"
, total:
"d[0].TotalItems"
},
change:
function
() {
$(
"#my-scrollview"
).data(
'kendoMobileScrollView'
).refresh();
}
});
}
function
initcontent(e) {
var
scroller = e.view.scroller;
scroller.reset();
GetContent(
"#cntpagehtml"
, e.view.params.p);
var
Section = 0;
switch
(e.view.params.p)
{
case
"meet-the-team"
:
GetGallery(3);
//Assign the _GalleryDS to my scrollview......
break
;
case
"design-consultancy"
:
GetGallery(6);
//Assign the _GalleryDS to my scrollview......
break
;
case
"point-of-sale"
:
GetGallery(4);
//Assign the _GalleryDS to my scrollview......
break
;
default
:
}
};
public
class
CountryViewModel
{
public
int
CountryID {
get
;
set
; }
public
string
CountryName {
get
;
set
; }
[UIHint(
"Presidents"
)]
public
int
? PresidentID {
get
;
set
; }
}
@(Html.Kendo().Grid<CountryViewModel>()
.Name(
"CountriesGrid"
)
.Columns(c =>
{
c.Bound(x => x.CountryName)
c.Bound(x => x.PresidentID)
.EditorTemplateName(
"Presidents"
)
})
.Editable(e => e.Mode(GridEditMode.InCell))
.Events(x => x.Edit(
"onEdit"
))
.DataSource(ds => ds
.Ajax()
.ServerOperation(
false
)
.AutoSync(
true
)
.Model(m =>
{
m.Id(x => x.CountryID);
m.Field(x => x.CountryID).Editable(
false
);
m.Field(x => x.PresidentID).DefaultValue(1);
})
.Read(r => r.Action(
"GetCountries"
,
"Country"
))
.Update(u => u.Action(
"UpdateCountry"
,
"Country"
))
)
)
<script>
function
getCountryID() {
var
row = $(event.srcElement).closest(
"tr"
);
var
grid = $(event.srcElement).closest(
"[data-role=grid]"
).data(
"kendoGrid"
);
var
dataItem = grid.dataItem(row);
return
{ CountryID: dataItem.CountryID }
}
//for InCell edit mode
function
onEdit(e) {
var
dropDown = e.container.find(
"[data-role=dropdownlist]"
).data(
"kendoDropDownList"
);
if
(dropDown) {
dropDown.bind(
"change"
,
function
(e) {
var
grid = e.sender.wrapper.closest(
".k-grid"
).data(
"kendoGrid"
);
var
dataItem = grid.dataItem(e.sender.wrapper.closest(
"tr"
));
//If current value is null
if
(!dataItem.PresidentID) {
//change the model value
dataItem.PresidentID = 0;
//get the currently selected value from the DDL
var
currentlySelectedValue = e.sender.value();
//set the value to the model
dataItem.set(
'PresidentID'
, currentlySelectedValue);
}
});
}
}
</script>
@(Html.Kendo().DropDownListFor(m => m)
.DataValueField(
"ID"
)
.DataTextField(
"Name"
)
.AutoBind(
true
)
.OptionLabel(
"Select..."
)
.DataSource(ds => ds.Read(r => r.Action(
"GetPossiblePresidents"
,
"Country"
)
.Data(
"getCountryID()"
))
)
)