or
During try the new version 2023.1.425 mobile listview component, when we binding data and used the template, we found the prompt data [0].
uid is undefined, The old version did not find this problem, the new version of this problem, I do not know why.
see the link
https://dojo.telerik.com/?_gl=1*dxcc66*_ga*MTQyMzc3MjYyLjE2NzgwNzg5MjA.*_ga_9JSNBCSF54*MTY4NjA5NjI4NC4xMC4xLjE2ODYwOTYzMTguMjYuMC4w
@{
ViewBag.Title = "Home Page";
}
<
script
id
=
"contact-template"
type
=
"text/x-kendo-template"
>
<
div
class
=
"mm-contact"
>
<
span
class
=
"mm-title"
data-bind
=
"text: Title"
></
span
><
br
/>
<
span
data-bind
=
"text: FirstName"
></
span
> <
span
data-bind
=
"text: LastName"
></
span
><
br
/>
Extension: <
span
data-bind
=
"text: Extension1"
></
span
><
br
/>
mail: <
span
data-bind
=
"text: Email"
></
span
>
</
div
>
</
script
>
<
div
id
=
"ProductSales"
data-role
=
"view"
data-model
=
"vm"
data-layout
=
"default"
data-title
=
"Product Sales"
>
<
header
data-role
=
"header"
>
<
div
data-role
=
"navbar"
>Product Sales</
div
>
</
header
>
<
div
id
=
'lv'
data-role
=
"listview"
data-bind
=
"source: productSalesContacts"
data-template
=
"contact-template"
></
div
>
</
div
>
<
script
type
=
"text/javascript"
>
var Staff = kendo.data.Model.define({
id: "ID",
fields: {
// data type of the field {Number|String|Boolean|Date} default is String
ID: { type: "Numeric", editable: false, nullable: true },
LastName: { type: "String", validation: { required: true } },
FirstName: { type: "String", validation: { required: true } },
Title: { type: "String" },
City: { type: "String" },
State: { type: "String" },
Email: { type: "String" },
Phone1: { type: "String" },
Extension1: { type: "String" },
Sequence: { type: "Numeric", nullable: true }
}
});
var vm = kendo.observable({
productSalesContacts: new kendo.data.DataSource({
transport: {
read: {
url: "/Services/Contacts.asmx/ProductSales",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8"
},
},
schema: {
data: "d",
model: Staff
}
})
});
</
script
>
@{
ViewBag.Title = "Home Page";
}
<
script
id
=
"contact-template"
type
=
"text/x-kendo-template"
>
<
div
class
=
"mm-contact"
>
<
span
class
=
"mm-title"
data-bind
=
"text: Title"
></
span
><
br
/>
<
span
data-bind
=
"text: FirstName"
></
span
> <
span
data-bind
=
"text: LastName"
></
span
><
br
/>
Extension: <
span
data-bind
=
"text: Extension1"
></
span
><
br
/>
mail: <
span
data-bind
=
"text: Email"
></
span
>
</
div
>
</
script
>
<
div
id
=
"ProductSales"
data-role
=
"view"
data-model
=
"vm"
data-layout
=
"default"
data-title
=
"Product Sales"
>
<
header
data-role
=
"header"
>
<
div
data-role
=
"navbar"
>Product Sales</
div
>
</
header
>
<
div
id
=
'lv'
data-role
=
"listview"
data-bind
=
"source: productSalesContacts"
data-template
=
"contact-template"
></
div
>
</
div
>
<
script
type
=
"text/javascript"
>
var Staff = kendo.data.Model.define({
id: "ID",
fields: {
// data type of the field {Number|String|Boolean|Date} default is String
ID: { type: "Numeric", editable: false, nullable: true },
LastName: { type: "String", validation: { required: true } },
FirstName: { type: "String", validation: { required: true } },
Title: { type: "String" },
City: { type: "String" },
State: { type: "String" },
Email: { type: "String" },
Phone1: { type: "String" },
Extension1: { type: "String" },
Sequence: { type: "Numeric", nullable: true }
}
});
var vm = kendo.observable({
productSalesContacts: new kendo.data.DataSource({
transport: {
read: {
url: "/Services/Contacts.asmx/ProductSales",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8"
},
},
schema: {
data: "d",
model: Staff
}
})
});
</
script
>
var JobActionItemDataSource = new kendo.data.DataSource({
pageSize: 15,
serverPaging: true,
transport: {
read: function (options) {
window.kendoMobileApplication.showLoading();
$.ajax({
url: urlstring + "GetJobTaskByEmployeeID",
data: {
UserID: JSON.stringify(localStorage.getItem("AuthorizedUserId")),
CompanyType: JSON.stringify($('#radio_Marketing').attr('checked') ? 1 : 0),
PageSize: options.data.pageSize,
PageNumber: JobActionItemPageIndex
},
dataType: "jsonp",
success: function (result) {
options.success(result.d);
JobActionItemPageIndex += 1;
}
});
},
data: function (response) {
alert(response.d);
return response.d;
}
}
});
// view design here
<
div
data-role
=
"view"
data-title
=
"Action items"
id
=
"view-actionitems"
data-init
=
"init_ActionItemsLanding"
data-show
=
"show_ActionItemsLanding"
>
<
header
data-role
=
"header"
>
<
div
>
<
img
src
=
"img/CompanyLogo.png"
width
=
"100px"
height
=
"34px"
/>
<
a
class
=
"km-rightitem"
data-rel
=
"popover"
href
=
"#popover-actionitems"
data-role
=
"button"
>Jump To</
a
>
<
a
class
=
"km-rightitem"
data-click
=
"Logout"
data-role
=
"button"
>Logout</
a
>
</
div
>
</
header
>
<
ul
id
=
"endlessscrolling-JobActionItemsBinding"
>
</
ul
>
</
div
>
/// script code
<
script
id
=
"endlessscrolling-JobActionItemsBinding-template"
type
=
"text/x-kendo-template"
>
<
div
class
=
"tweet"
>
<
div
class
=
"notesmessage"
>
<
span
>
#if(JobID!=0){#
<
div
> <
a
id
=
"WorkFlowTaskId=#=WorkFlowTaskId#&RequiredCompletionActionID=#=RequiredCompletionActionID#&JobID=#=JobID#&TaskID=#=TaskID#"
data-role
=
"button"
class
=
"km-button"
data-click
=
"GoActionitemcompleteevent"
style
=
"width:auto; background: none repeat scroll 0 0 transparent;box-shadow: none;color: blue;margin-left: 0;text-decoration:underline;padding: 5px;width: auto;text-align: left;"
>#= Task #</
a
></
div
>
<
br
/>
#=DueTimeFrameColorFormat#
#} else{#
#= Task # <
br
/>
#}#
#= DueTimeFrame # </
span
>
<
div
style
=
"text-align: center;"
>
#if(JobID!=0){#
<
a
id
=
"#=JobID#"
data-role
=
"button"
data-click
=
"job_jobdetails"
style
=
"width:145px;padding: 5px;"
>#= JobNumber # </
a
>
<
a
name
=
"0"
id
=
"WorkFlowTaskId=#=WorkFlowTaskId#&RequiredCompletionActionID=#=RequiredCompletionActionID#&JobID=#=JobID#&TaskID=#=TaskID#"
data-role
=
"button"
data-click
=
"GoActionitemcompleteevent"
style
=
"width:70px;padding: 5px;"
>Complete</
a
>
<
br
/> #}#
<
a
id
=
"#=CustomerID#&Type=#=CustomerType#"
data-role
=
"button"
data-click
=
"GotoViewContactInformation"
style
=
"width:145px;padding: 5px;"
><
span
style
=
"font-size: 0.8em; font-style:italic;"
>#= EmployeeName #</
span
></
a
>
#if(JobID!=0){#
<
a
id
=
"ID=#=JobID#&JobNumber=#=JobNumber#"
data-role
=
"button"
data-click
=
"GoToViewJobAddActionItems"
style
=
"width:70px;padding: 5px;"
>Add</
a
>
#}else{#
<
a
id
=
"ID=#=CustomerID#&Type=#=CustomerType#&ContactName=#=EmployeeName#"
data-role
=
"button"
data-click
=
"GoToViewAddMarketingActionItem"
style
=
"width:70px;padding: 5px;"
>Add</
a
>
#}#
</
div
>
</
div
>
</
div
>
</
script
>
// init function
function init_ActionItemsLanding(e) {
$("#endlessscrolling-JobActionItemsBinding").kendoMobileListView({
dataSource: JobActionItemDataSource,
template: kendo.template($("#endlessscrolling-JobActionItemsBinding-template").text()),
endlessScroll: true,
scrollTreshold: 30
});
}
// show funciton
JobActionItemPageIndex = 1;
var refreshJobActionItems = $("#endlessscrolling-JobActionItemsBinding").data("kendoMobileListView");
refreshJobActionItems.dataSource.read(1);
refreshJobActionItems.refresh();
function
loadTwitterFeed() {
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"http://api.twitter.com/1/statuses/user_timeline.json"
, // the remove service url
dataType:
"jsonp"
// JSONP (JSON with padding) is required for cross-domain AJAX
},
parameterMap:
function
(options) {
return
{
screen_name:
"USER_NAME"
,
count: 10,
since_id: options.since_id,
//additional parameters sent to the remote service
max_id: options.max_id
//additional parameters sent to the remove service
};
}
}
});
$(
"#twitter-feed"
).kendoMobileListView({
dataSource: dataSource,
template: $(
"#twitter-template"
).text(),
appendOnRefresh:
true
,
pullToRefresh:
true
,
//addition parameters which will be passed to the DataSource's read method
pullParameters:
function
(item) {
//pass first data item of the ListView
return
{
since_id: item.id_str
};
},
endlessScroll:
true
,
//addition parameters which will be passed to the DataSource's next method
endlessScrollParameters:
function
(firstOrigin) {
if
(firstOrigin) {
return
{
max_id: firstOrigin.id_str
};
}
}
});
}