Need help in refreshing the wired app

nitish.kumar
User offline. Last seen 6 weeks 5 days ago. Offline
Joined: 02/22/2011
Points: 30

Hi

I just created a wired application in the mashboard, where the 2nd application is the property view which gets populated on the selection of an table entry in the 1st application(the URL selected in the 1st application is the input to the second application ). The peroblem which I am facing is that initally while launching the application, the 2nd application already has the details for a default URL. I tried specifying an empty string as default URL, but the application shows an error showing No Object. Also once the URL selects a different URL in the 1st application, the intention is to clean up the stale entries in the 2nd application of the previous selection.

 

Is there a way we show a blank frame/layout before displaying the intended result in the application?

Or there are other ways to work around this?

 

Thanks in Advance

Nitish

 

0
Your rating: None
jeremy.pitten
jeremy.pitten's picture
User offline. Last seen 5 weeks 3 days ago. Offline
Joined: 09/22/2008
Points: 275

 

If you want to change the second app so it doesnt display the proprty table until it receives data from the first app then one way to solve this is to extend the app javascript implementation. All the apps created using the App Maker wizard have the same underlying javascript implementation. 

Open the app in the App Editor. The App Spec should be displayed in the editor and teh drop down chocie should contain a single entry, App.xml.

Click the "Add" link, next to the drop down choice, and add a new javascript resource. Call it something like "extended-basic-app.js". Paste in the following code and save:

 

Sample.ExtendedBasicApp = function(app){
    var that = new Presto.BasicApp(app),
    basicReceive = that.receive,
    root = jQuery(app.getRootElement());

    that.receive = function(obj){
        root.show();
        basicReceive.call(that, obj);
    };
    root.hide();
    return that;
}

 

Update the App.xml to point to this new Constructor function, by replacing the jsclass attribute value in the root <app> tag, so the App spec should now contain:

<app ...... jsclass="Sample.ExtendedBasicApp".... >

 

and save again.

All this extended version of Presto.BasicApp does is hide the app when it is first rendered, getting hold of a reference to the app's root element and using the jQuery hide method. It then overrides the Presto.BasicApp receive method which is called each time a subscribed event is received, and it uses the jQuery show method to display the app. 

 

You could also use this extended version of Presto.BasicApp to filter events, for example, if you only wanted to refresh the PropertyView if teh url changes you could use something like:


    var previousUrl;
    that.receive = function(obj){
        if(obj.url != previousUrl){
           previousUrl = object.url;
           root.show();
           basicReceive.call(that, obj);
        }
    };
 
I've created an example workspace app on the cloud here:
http://prestocloud.jackbe.com/prestohub/applauncher.html?mid=Local_Pizza_Search
 
Here's a link to the extended property view app:
http://prestocloud.jackbe.com/prestohub/app-editor.html?mid=Local_Pizza_Search_Property_View

 

 

 

 

nitish.kumar
User offline. Last seen 6 weeks 5 days ago. Offline
Joined: 02/22/2011
Points: 30

Hello Jeremy

Thanks for the reply and the great help. I am sure I would be able to get this working for me and I would be trying out the same as you have guided.

Mean while request you to please allow me permissions to access the example applications which you have created. My user id is nitish.kumar

Thanks Again

Nitish

jeremy.pitten
jeremy.pitten's picture
User offline. Last seen 5 weeks 3 days ago. Offline
Joined: 09/22/2008
Points: 275

My mistake, I've changed the security settings on the apps so any logged in user can view. Let me know if you have any problems.