The problem i'm trying to solve is, I want to have a tap event with a parameter in XML:
I know that, this format will not work. so what is the correct format?
Use case: in a list view you want to open a url
Cheers
The problem i'm trying to solve is, I want to have a tap event with a parameter in XML:
I know that, this format will not work. so what is the correct format?
Use case: in a list view you want to open a url
Cheers
Aren't the params set in the XML directly consumable in the js?
Like on a regular tap
var button = args.object;
var param = button.myparam;
Where the XML would have been
<Button myparam="test"
I knew someone who used to pass data around in the XML over just using args.object.bindingContext and using the bound data directly. I THINK this is how he was doing it.
So on a Listview itemTap event I think it'd be something like this
var param = args.view.myparam;
tap or listTap event defined and pass the {{ url }} to it. something like this: `label tap="ontap( {{ url }})" . <- I know that this syntax is wrong, by the way.The easiest way of doing something like this would be to just have the onTap="myTapEvent" on the ListView itself.
Then in the js, you would get the index of the tapped item and fetch it from the original array:
exports.myTapEvent = function(args){
var tappedItem = myListArray.getItem(args.index);
var url = tappedItem.url;
}
I am not sure if it is possible to add events to specific items inside the ListView.itemTemplate...