Hi,
I've been having trouble getting at the data associated with a list view item. In the event handler for the data-click event event I get an event parameter that doesn't seem to have any of the properties referenced in the sdk. Only the data-item property is undefined.
onLibraryItemClick e:[object Object]
06-26 13:01:29.439 1203-1203/com.verbum.wordhose.android I/Web Console: app: onLibraryItemClick e:onLibraryItemClick e.item:[object Object]
06-26 13:01:29.459 1203-1203/com.verbum.wordhose.android I/Web Console: app: onLibraryItemClick e.target:[object Object] at :2
06-26 13:01:29.459 1203-1203/com.verbum.wordhose.android I/Web Console: app: onLibraryItemClick e.dataItem:undefined at :2
The weird thing is that I am able to add new items to listview and they render correctly. So the template seems to be wired up correctly.
The related HTML is:
The click event JS is:
And the code that adds the json item to the dataSource is:
Like I said, items get added and rendered correctly in the listview itself, but there's no associated dataItem.
Help :) ?
Thanks.
I've been having trouble getting at the data associated with a list view item. In the event handler for the data-click event event I get an event parameter that doesn't seem to have any of the properties referenced in the sdk. Only the data-item property is undefined.
onLibraryItemClick e:[object Object]
06-26 13:01:29.439 1203-1203/com.verbum.wordhose.android I/Web Console: app: onLibraryItemClick e:onLibraryItemClick e.item:[object Object]
06-26 13:01:29.459 1203-1203/com.verbum.wordhose.android I/Web Console: app: onLibraryItemClick e.target:[object Object] at :2
06-26 13:01:29.459 1203-1203/com.verbum.wordhose.android I/Web Console: app: onLibraryItemClick e.dataItem:undefined at :2
The weird thing is that I am able to add new items to listview and they render correctly. So the template seems to be wired up correctly.
The related HTML is:
<
div
id
=
"libraryPage"
data-role
=
"view"
data-layout
=
"appLayout"
data-title
=
"library"
data-init
=
"initLibraryListView"
>
<
p
id
=
"wh_status"
>disconnected</
p
>
<
div
class
=
"head"
>Wordhose Library</
div
>
<
ul
id
=
"library-listview"
data-role
=
"listview"
data-init
=
"initLibraryListView"
data-click
=
"onLibraryItemClick"
>
</
ul
>
<!-- <img class="item-photo" src="${url}" /> -->
<
script
type
=
"text/x-kendo-template"
id
=
"libraryListViewTemplate"
>
<
h3
class
=
"item-title"
>${Title}</
h3
>
<
p
class
=
"item-info"
>Text Status Data Here</
p
>
</
script
>
</
div
>
function onLibraryItemClick(e) {
console.log("app: onLibraryItemClick e:" + e);
console.log("app: onLibraryItemClick e.item:" + e.item);
console.log("app: onLibraryItemClick e.target:" + e.target);
console.log("app: onLibraryItemClick e.dataItem:" + e.dataItem);
//console.log("app: onLibraryItemClick e.target:" + JSON.stringify(e.target));
_CurrentTextData = e.dataItem;
//console.log("app: e.dataItem.Title=" + e.dataItem.Title);
};
_LibraryListViewDataSource.add(sampleText);
Help :) ?
Thanks.