How do you implement content switching in a single page in qooxdoo - qooxdoo

How to implement the content switch in qooxdoo, switch the contents of the container with click event, and load the data and controller in real time

You can use the stack container in order to switch between containers.
If you have troubles how to use the stack container see the demo in the demo browser here. So in order to load the data to your controller you should add a listener for the appear event in the appropriate container :)

Related

Reload once content is loaded, Loading animation?

I am using Ionic for just a simple tab app that displays some info I load from an external source (in this case parse). It works pretty well, although sometimes I am noticing that I click a view and the view will be blank. When I tap the tab again it populates the list with the view from the server. I am assuming this is the app taking a momment to load the data.. it seems to take less than a second, but dosen't then update.
Has anyone seen this? I was thinking I could probably just build some sort of loading thing that shows? Is there an easy solution to basically refresh the view once the content has been loaded?
Use a Boolean controller variable in your controller, when everything loaded and all promises resolved set it to true
In your view wrap everything in ... Ng-if='controller.loading===true'
You could also create another div that says ... Ng-if loading===false
And inside it put a loading icon
Remember to initialise controller variable to false initially

dynamic view loading in custom directives' widget in angularJS

I am using custom Directive's approach in AngularJS for making dashboard with widgets and for widgets m using angular-gridster
(https://github.com/ManifestWebDesign/angular-gridster).
Requirements:
On right side menu created by custom directive is present.and for routing purpose UI Router in used.
1-I need to open a dashboard firstly empty.
2-when click to Menu1 one widget is opened with data from state menu1 and same for Menu2
3-when 2nd option is clicked another widget added to dashboard without affecting previously opened one and so on.
4-all the widgets have independent data.and navigation in each widget is according to the respective menu.
WorkFlow:
1-empty dashboard is opened via custom directive.
2-widgets are added by providing click event to menu1 and menu2.which will broadcast event.and against that click event a widget is added to widgets array holding information about that widget.
Problem:
problem is routing basically.till now there is no routing involved.info is passed by broadcasting a click event.and by this i have achieved this coloured area.
but the further navigation creates problem.when a state changes by clicking Menu1 or Menu2 it affects both the widgets and and ui-view portion in both widgets show same data.if Menu1 is clicked both widgets show data from Menu1 and vice versa.
Now.i have tried enough solutions but here i want an idea from ui router experts or custom directives' experts.cz i hv tried many possible ways and stuck here for almost a week.
Thanx very very much if anyone can help.

Is a given component in view?

In Ext JS 4, is there a simple way to determine if a component is actually in view? That is both visible and within the area currently displayed in the browser window.
I am aware of isVisible(), which will tell me if it is visible in the DOM, but I would also like to know if the component has been scrolled out of view (and therefore does not need updating visually).
You could use Component.getX(), Component.getY(), Component.getHeight(), Component.getWidth() of your main container and your component and compute that manually (also check the scroll methods of the main component).

How to hide a CQ component dynamically using Extjs?

I need to hide a CQ component from the page, when I select a particular value from another components dialog. Is this possible using ExtJS?
Yes, it is possible, but without more info it is difficult to give more details. In general, you can look up the xtypes you are using in your dialog at http://dev.day.com/docs/en/cq/current/widgets-api/index.html. Find the events that are available for the xtypes you are using in the dialog, then add a listener for one of the events exposed by that xtype. That allows you to run your own JavaScript code in response to an event--and that code could do things like hide HTML DOM elements.
Here is an example of using a listener to add custom functionality in response to an event: http://cq.shishank.info/2011/12/20/adding-limit-to-multifiled/
And here is another example: CQ5 - Hiding a tab within a component dialog depending on user group?

How to create multi-page app with ExtJs 4

I should create ExtJs4 app, which should have main menu, and each menu item should open a new page with different url, so if the user copies the url and pastes on other browser tab, the app should open that menu item.
I want to use ExtJs's recommended MVC architecture, but I don't know how I can use it with multiple pages/urls. All their examples are using single page.
One option is to reload the page each time when the user clicks on particular menu Item, so every url/menu item/page will be separate ExtJS app with it's MVC. But I think this approach has drawbacks, since the page will be reloaded every time and it's not good for performance. Also it's causes difficulties in reusing of components (common models, stores and views for different pages ).
So I would like to have one single app for all pages, but I don't know is there any solution to have different urls for different views (in my case: for different menu items).
Or is there another approach for such applications?
You would probably want to use a Viewport, and make the Center Region a Container.
The Center Region Container would usually have a Card or Tab layout.
When the user navigates to a new view (Component), you add that view to the Container, and make it active.
The big mistake is to change the URL first. You don't want to do that.
You want to navigate, and then set the URL if the navigation was successful. You should probably not use ExtJS's History component, as it is incorrectly implemented. I would recommend using HTML5 pushState.
You should make sure your navigation system works without changing the URL bar too.
I would recommend reading up on Navigation in Microsoft Prism, WPF, and Silverlight, as there is more documentation there, and then apply that to ExtJS.
http://msdn.microsoft.com/en-us/library/gg430881(v=pandp.40).aspx
Here is an example Navigation process:
call app.requestNavigate('contacts/5'); you would add this yourself.
you parse this fragment to:
navigationContext = {
fragment: 'contacts/5',
xtype: 'contacts-form',
parameters:{
id: 5
}
}
OPTIONAL: If using forms:
get active item from the navigation region (your center region). if exists, call confirmNavigationRequest(callback) . you will need to add this method or event.
if callback(true), proceed with the navigation. this allows the user to cancel a navigation, if say the form is "dirty"
END OPTIONAL
the easy way is to then create a new widget of navigationContext.xtype, add it to the navigation region, then call setActiveItem(widget). destroy the previous active item if it existed.
then call history.pushState(null, null, navigationContext.fragment)
then raise a 'navigatedto' event on the view, passing the context, and you can load the data from there.
More advanced scenarios include:
keep the previous component alive if you expect to return to it. add a keepAlive property and if true, don't destroy when add new components to container.
search the container and ask each component if it wants to handle the current navigation request (for example if a form loaded with contact-5 was already hidden in your navigation region, or if you want to re-use a form)

Resources