Hello,
I notice a weird issue with the ListViewEventData.
Here is my ListView in XML:
<
lv:RadListView
items
=
"{{ favorites }}"
itemTap
=
"onItemTap"
itemLoading
=
"onItemLoading"
>
<
lv:RadListView.listViewLayout
>
<
lv:ListViewLinearLayout
scrollDirection
=
"Vertical"
/>
</
lv:RadListView.listViewLayout
>
<
lv:RadListView.itemTemplate
>
<
StackLayout
>
<
GridLayout
rows
=
"auto"
columns
=
"*,10,auto"
>
<!-- ... -->
</
GridLayout
>
<
StackLayout
className
=
"separator"
/>
</
StackLayout
>
</
lv:RadListView.itemTemplate
>
</
lv:RadListView
>
Here is my tap event:
exports.onItemTap =
function
(args) {
var
listview = args.object.parent;
var
bindingContext = args.object.bindingContext;
var
currentItem = listview.getItemAtIndex(args.itemIndex);
};
The problem:
I try to store a reference to the RadListView instance, that has triggered the tap-event. While the above code is working as expected, the app crashes on Android
with the error message listview.getItemAtIndex is not a function.
I noticed, that args.object.parent.parent would point to the RadListView instance on Android.
We have a TabView with about 4-5 Tabs and each of them contains one RadListView with different data, so I don't want to apply an ID to each TabView to access it. I thought the event-arguments contain the information, which RadListView has triggered the event.
Now I do not know if this is an already known bug or if this refers to my own code in any way.
And when I raise the itemSelected event, then args.object points to the corresponding RadListView instance for both, Android and iOS... which is a bit confusing.
We are working with:
- NativeScript 2.5 (tns-core-modules 2.5.2)
- Telerik UI for NativeScript 1.6.1
Best regards,
Marc