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
Developer
marcossit
Posts: 176
Registered: ‎07-19-2012
My Device: Z10 Limited Edition and Dev Alpha C

Error Listview and Webview...

I have the following code courtesy of http://bbcascades.com/  Written by Brian S.

 

     Page {
         titleBar: TitleBar {
             title: "Newsday"
         }
         Container {
             ListView {
                 id: myListView
  
                 dataModel: myDataModel
                 listItemComponents: [
 ListItemComponent {
                         type: "header"
                         Container {
                        layout: DockLayout {
                        }
                        Label {
                                 text: "Noticias"
                             }
                         }
                     },
 ListItemComponent {
                         type: "item"
  
                         // Custom List compoents
                         Container {
                             Label {
                                 text: ListItemData.title
                                 textStyle.fontWeight: FontWeight.Bold
                                 multiline: true
                             }
                             Label {
                                 text: ListItemData.pubDate
                             }
                             Label {
                                 text: ListItemData.description
                                 textStyle.fontSize: FontSize.Small
                                 multiline: true
                             }
                             Divider {
                             }
                         }
                     }
                 ]
                 onTriggered: {
                     var feedItem = myDataModel.data(indexPath);
                     var page = detailsPage.createObject();
                     page.htmlContent = feedItem.link;
                     newsPane.push(page);
                 }
             }
         }
     
     attachedObjects: [
  GroupDataModel {
            id: myDataModel
            sortingKeys: [
                "order"
            ] //[  "pubDate" ]
            grouping: ItemGrouping.ByFirstChar
            sortedAscending: true
        },
        DataSource {
            id: myDataSource
            source: "http://newsday.co.tt/rss.xml"
            query: "/rss/channel/item"
            type: DataSourceType.Xml
            onDataLoaded: {
                myDataModel.clear();
                myDataModel.insertList(data)
            }
        },
        ComponentDefinition {
            id: detailsPage
            Page {
                property alias htmlContent: detailsView.url
                Container {
                    layout: DockLayout {
                    }
                    Container {
                        ScrollView {
                            scrollViewProperties.scrollMode: ScrollMode.Both
                            scrollViewProperties {
                                pinchToZoomEnabled: true
                                maxContentScale: 5
                                minContentScale: 1
                            }
                            WebView {
                                id: detailsView
                                settings.zoomToFitEnabled: true
                                settings.activeTextEnabled: true
                                onLoadProgressChanged: {
                                    // Update the ProgressBar while loading.
                                    progressIndicator.value = loadProgress / 100.0
                                }
                                onLoadingChanged: {
                                    if (loadRequest.status == WebLoadStatus.Started) {
                                        // Show the ProgressBar when loading started.
                                        progressIndicator.opacity = 1.0
                                    } else if (loadRequest.status == WebLoadStatus.Succeeded) {
                                        // Hide the ProgressBar when loading is complete.
                                        progressIndicator.opacity = 0.0
                                    } else if (loadRequest.status == WebLoadStatus.Failed) {
                                        // If loading failed
                                        html = "<html><head><title>Loading Failed</title></head> 
                                                 <body>Check Internet connection?</body></html>"
                                        progressIndicator.opacity = 0.0
                                    }
                                }
                            }
                        }
                    }
                    Container {
                        bottomPadding: 25
                        horizontalAlignment: HorizontalAlignment.Center
                        verticalAlignment: VerticalAlignment.Bottom
                        ProgressIndicator {
                            id: progressIndicator
                            opacity: 0
                        }
                    }
                }
            }
        }
    ]
    onCreationCompleted: {
        myDataSource.load();
    }
}

 IMG_00000139.png

 

When I click the Webview not working, not working what could be the error?

 

If I want to add an image to each entry How can I?

 

PS: This code was created by Brians. of http://bbcascades.com/ and not my creation.

 


Follow me in Twitter:

@Marcossit

BBM Channel:

MarcossitDev: C0002C366  

DeviceSuite For BlackBerry 10:

Link to Download DeviceSuite:

Support was successful? Accept as Solution and click on:


Developer
marcossit
Posts: 176
Registered: ‎07-19-2012
My Device: Z10 Limited Edition and Dev Alpha C

Re: Error Listview and Webview...

Error Listview and Webview...


Follow me in Twitter:

@Marcossit

BBM Channel:

MarcossitDev: C0002C366  

DeviceSuite For BlackBerry 10:

Link to Download DeviceSuite:

Support was successful? Accept as Solution and click on: