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
Posts: 73
Registered: ‎04-08-2014
My Device: Z10
My Carrier: XL

Re: How to refresh a qml using button?

thanks for all comments

i end up with new page with addcomment.qml

when i add the comment

i have allcomment.qml that append on model

in my addcomment.qml

function postreviewDone(response){
        //toast.body = "Server response:\n"+response
        //toast.show()
        
        toast.body ="Add comment successfull"
        toast.show()
        activePane.pop()
        
    }

 activePane.pop() is just back to allcomment.qml

how to refresh it?

activePane.load() or activePane.refresh() or somethin?

thanks

Developer
Posts: 161
Registered: ‎01-03-2013
My Device: n/a
My Carrier: n/a

Re: How to refresh a qml using button?

[ Edited ]

What do you want to refresh, the model?

Regards.

If my answer has been useful to you, please, click the button
Developer
Posts: 73
Registered: ‎04-08-2014
My Device: Z10
My Carrier: XL

Re: How to refresh a qml using button?

entire page

is it possible?

Developer
Posts: 161
Registered: ‎01-03-2013
My Device: n/a
My Carrier: n/a

Re: How to refresh a qml using button?

[ Edited ]

No, to reload a qml would mean destroy and create again all the elements. That's counterproductive for your app performance.

Regards.

If my answer has been useful to you, please, click the button
Developer
Posts: 73
Registered: ‎04-08-2014
My Device: Z10
My Carrier: XL

Re: How to refresh a qml using button?

oke, so i just want to refresh model

as u can see on my previous post

i dont have any DataSource on it

how can i refresh only the model in the addcomment.qml?

the model show because i parse it from businessreview function

and json will parse the model

thanks Smiley Happy

Developer
Posts: 73
Registered: ‎04-08-2014
My Device: Z10
My Carrier: XL

Re: How to refresh a qml using button?

any help? thanks

Developer
Posts: 161
Registered: ‎01-03-2013
My Device: n/a
My Carrier: n/a

Re: How to refresh a qml using button?

Why don't you use a DataSource?

Regards.

If my answer has been useful to you, please, click the button
Developer
Posts: 73
Registered: ‎04-08-2014
My Device: Z10
My Carrier: XL

Re: How to refresh a qml using button?

because i already append it in the function that i made

function businessdetailreviewrefresh(response){
        indicator.stop()
        model1.clear()
        console.log("Response: "+response)
        var json1 = JSON.parse(response)
        if(json1){
            model1.append(json1.review_result)   
        }
        //bdetail.review_result = json1.review_result
    
    }

 see the model1.append(json1.review_result)??

thats why i dont use the datasource

how to transfer that json1.review_result to DataSource ya?

thanks

Developer
Posts: 161
Registered: ‎01-03-2013
My Device: n/a
My Carrier: n/a

Re: How to refresh a qml using button?

[ Edited ]

If you are popping a page from navigationPane and you want to reload the model in the "parent" page, then do this:

 

NavigationPane {
 onPopTransitionEnded: {
  page.destroy();
  dataSource.load();
 }
 attachedObjects: [
   DataSource {
     id: datasource
     source: YOUR JSON FILE
     onDataLoaded: {
      YOUR_DATAMODEL.clear();
      YOUR_DATAMODEL.append(data);
     }
   }
  ]
}

 With a dataSource you don't have to parse the JSON yourself, it does it for you.

Regards.

If my answer has been useful to you, please, click the button
Highlighted
Developer
Posts: 73
Registered: ‎04-08-2014
My Device: Z10
My Carrier: XL

Re: How to refresh a qml using button?

so my source from datasource is json.review_result?? or what?

i confuse about my JSON