I am form iOS background so i will give example of UITableView in iOS.
in table view when we create custom Cell for our application then we get the child view by putting "TAG" on each view including buttons . and it becomes easy to get the "INDEX OF ROW" by clicking on any UIButton.
mean suppose we have a custom list which include many labels, images and button. we can track the specific Cell by clicking on label and images but when we click on Button it does not give us index of that cell until we use some technique to handle this and mostly programmers use tagging to track the view inside cell .
Now my Question is "SAME I WANT TO DO WITH BLACKBERRY 10 LISTVIEW" .
In my situation i have a list view and on click it opens the specific View related to that cell. every thing is working fine when i click on cell every where except Button .
How can i track the index of that Cell on clicking the button. because using index i have to pick value from dataModel .
Please let me know if i am able to tell my problem
Edits:
This is my Code
I define my list view as
ListView {
translationY: 130
dataModel: dataModelList
listItemComponents: [
ListItemComponent {
type: "item"
Chekdata {
}
}
]
onTriggered: {
var showDetail = productDetailPageID.createObject();
showDetail.myProfileData=dataModel.data(indexPath);
navigationPane.push(showDetail);
console.log(dataModel.data(indexPath)["cat_name"]);
}
}
where Chekdata.qml is like this
import bb.cascades 1.0
import org.labsquare 1.0
Container {
preferredHeight: 600
preferredWidth: 768
layout: AbsoluteLayout {
}
WebImageView {
id: img
url: ListItemData.offer_image
preferredWidth: 610
translationY: 70.0
translationX: 70.0
preferredHeight: 250
}
Label {
text:ListItemData.member_id
translationY: 320.0
translationX: 70.0
}
Label {
text: ListItemData.offer_type
translationX: 70
translationY: 350
}
Label {
text: "Category:"
translationY: 400
translationX: 70
textStyle.fontSize: FontSize.XSmall
}
Label {
text: ListItemData.cat_name
translationY: 400
translationX: 210
textStyle.fontSize: FontSize.XSmall
}
Label {
text: "Offer Added Date:"
translationY: 440
translationX: 70
textStyle.fontSize: FontSize.XXSmall
}
Label {
text: ListItemData.date_start
translationY: 440
translationX: 250
textStyle.fontSize: FontSize.XXSmall
}
Label {
text: ListItemData.discount
translationY: 480
translationX: 70
}
Label {
text: "coupon Left :"
translationX: 400
translationY: 320
textStyle.fontSize: FontSize.XSmall
}
Label {
text: ListItemData.coupon_code
translationX: 570
translationY: 325
textStyle.fontSize: FontSize.XXSmall
}
Label {
text: "Location:"
translationX: 400
translationY: 360
textStyle.fontSize: FontSize.XSmall
}
Label {
text: ListItemData.location
translationX: 520
translationY: 360
textStyle.fontSize: FontSize.XSmall
}
Label {
text: "offer Expires :"
translationX: 400
translationY: 400
textStyle.fontSize: FontSize.XXSmall
}
Label {
text: ListItemData.date_end
translationX: 540
translationY: 400
textStyle.fontSize: FontSize.XXSmall
}
ImageButton {
defaultImageSource: "asset:///images/BlueNoseBig.png"
preferredHeight: 60
preferredWidth: 150
translationX: 500
translationY: 470.0
}
}
There are main Three elements Webimageview, label, and ImageButton. and you can see on above code the onTrigger function. this function is not call when i click on ImageButton