Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
selvaraman
Posts: 29
Registered: ‎09-07-2012
My Device: 9900

How to Reload a Listview in bb 10 qml?

[ Edited ]

am not able to access the datasource id from inside of the listitemcomponents .Can anyone help me about this regards?

 

ListItemComponent {
type: "item"
Container {

id: listviewcontainer
Container {
preferredWidth: 768
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
CustomImageView {
leftPadding: 10
rightPadding: 10
url: ListItemData.from_image
horizontalAlignment: HorizontalAlignment.Left
verticalAlignment: VerticalAlignment.Center
}
Container {
preferredWidth: 538
layout: StackLayout {
orientation: LayoutOrientation.TopToBottom
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Label {
text: ListItemData.from
textStyle {
base: SystemDefaults.TextStyles.TitleText
color: Color.create("#2db6ff")
}
}
ImageView {
imageSource: "asset:///Home/img.png"
verticalAlignment: VerticalAlignment.Center
}
}
Label {
text: ListItemData.message
multiline: true
textStyle {
base: SystemDefaults.TextStyles.SubtitleText
}
content {
flags: TextContentFlag.Emoticons
}
}
Label {
id: time
text: ListItemData.time
textStyle {
base: SystemDefaults.TextStyles.SmallText
color: Color.create("#666666")
}
}
}
ImageButton {
id: delete_btn
defaultImageSource: "asset:///Icon/delete.png"
pressedImageSource: "asset:///Icon/delete.png"
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Right
onClicked: {
deleteMessage(ListItemData.tid, ListItemData.uid);
}
function deleteMessage(tid, uid) {
var request = new XMLHttpRequest()
request.onreadystatechange = function() {
if (request.readyState == 4) {
var mResponse = request.responseText
mResponse = JSON.parse(mResponse)
var mResponseStatus = mResponse.response[0].receive.status;
var mMsg = mResponse.response[0].receive.message;
if (mResponseStatus == 1) {
message_DataSource.source = "newurl.com" //   This line not works here..
message_DataSource.load();                              //   This line not works here..
} else if (mResponseStatus == 0) {
}
}
}
request.open("GET", "myurl.com", true);
request.send();
}
}
}
Divider {
horizontalAlignment: HorizontalAlignment.Fill
}
}
}

Thanks,

Developer
Zmey
Posts: 1,523
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to Reload a Listview in bb 10 qml?

Contributor
selvaraman
Posts: 29
Registered: ‎09-07-2012
My Device: 9900

Re: How to Reload a Listview in bb 10 qml?

Thanks, for your reply, as your post i have tried like the below but it not works,can you help me?

 

listviewcontainer.ListItem.view.dataModel.message_DataSource.source = "myurl.com";
listviewcontainer.ListItem.view.dataModel.message_DataSource.load();

 

                            or

 

listviewcontainer.ListItem.view.dataModel.source = "myurl.com";
listviewcontainer.ListItem.view.dataModel.load();

 

Thanks,

Developer
oniongarlic
Posts: 78
Registered: ‎10-19-2012
My Device: Playbook, BB10DevAlphaB

Re: How to Reload a Listview in bb 10 qml?

Just in case, are you using proper URLs with protocol in your code ? http://myurl.com/ ?
Contributor
selvaraman
Posts: 29
Registered: ‎09-07-2012
My Device: 9900

Re: How to Reload a Listview in bb 10 qml?

yes. i have used the proper url like this http://myurl.com/ ?