Titanium Alloy - Empty a node (view / window) - titanium-alloy

I am figuring my way around Alloy (slowly !).
I would like to know if there a way we can easily destroy and remove all the UI elements with a node ? Do we have anything like ?
view.empty()
What I am trying to do is, when a tab is loaded, I want the view to insert a Label "loading ..." and should be removed after the data is ready.
Coming to my 2nd question: How do I delete a node ?
view.delete() ?

Something basic : There is always a parent child relation between the Views(nodes as you say), to delete a view you need to have a handle at its parent view.
For your first Question :
you can check This link.It will remove all child elements of a View.
For your second Question :
to delete a single view you have to do something like ParentView.remove(childView)
And yes Activity Indicator can be used to show a loader with/without message.
Hope it helps.

What you need is an Activity Indicator, here are the docs: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ActivityIndicator

Related

Can't access SelectedNode Value from asp Treeview in javascript

I have an asp page that has a Treeview on it that is populated in code behind (so not data-bound). As I expand the nodes eventually the list of item becomes so big that after the postback, I lose where I was in the tree. So I've been looking into using client-side script to use scrollIntoView but all the examples of how to get the current selected node (the node I just expanded), seem to fail for me.
var elem = document.getElementById('navTree_SelectedNode');
alert(elem.value);
For me the .value is always null, as though no item has been selected. I've tried calling this code on the window.load and also by running a script from the code-behind. So I know there are lots of posts of this is how to do it, but I can't get an ID back of the item so I can then do a document.getElementById() on to then run the scrollIntoView. Maybe I'm trying to access the value too early/late and it's not been set, so where would the best place for me to check this be?
I've also tried accessing it with:
var test = document.getElementById('navTree_Data.selectedNodeID');
and still no luck.
Just a thought, selected is the item I have just clicked on to expand, not Checked as the nodes have check boxes?
Many thanks
The issue was being caused by the .SelectAction on my nodes being set to TreeNodeSelectAction.Expand when it should be set to .SelectExpand.

Loader displays while DOM is updating

I've got a page where I am using relations to pull in various items
Dropdown lets you select an employee
Second dropdown lets you pick a timeframe
The table then pulls items related to the employee + timeframe
The problem is that the loader disappears before the screen is refereshed with the data from #3.
I've tried binding the visibility of the loader to multiple datasources
widget.datasource.loading || second_datasource.loading || ...
but I'm struggling to get it to appear for the duration of the load. Is there anything I can do to have it appear until my client is fully updated? Do I need to be manually manipulating visibility with jQuery or is there is an App Maker binding I should be using?
At this time App Maker doesn't provide any global variable (something like #app.isBusy) that would help you to tackle the problem, there is also no easy way to discover all datasources being loaded... So, the answer will be: you need to thoroughly investigate your code to discover all things you are loading. One more trick that I can recommend is specifying datasources explicitly:
#app.datasources.DsOne.loading ||
#app.datasources.DsTwo.loading ||
#app.datasources.DsThree.loading ||
...

adding new menu in Select (All,Inverted Selection) in Alfresco Share

I am newbie to the Alfresco.Now my requirement is how to add new menu[All(All pages)] in Select. wherever user perform search function lets say 250 results have found & user selects All in page 1 & its selecting only current page results and not selecting entire 250 records & then user goes page by page can edit the properties for the entire 250 records.in the new functionality if user selects [All(All pages)] then all records should be selected & edit the properties for 250 records at one go.So I want to add new menu with All(All pages) & change the existing menu current labels as All(Current Page).How to achieve this functionality and what files need to changed.How should i know that which files are currently used?Is there any debugger can be used to know the files?
Alfresco Version
4.2.e
My guess, is that if you go through this previous version of Jeff Potts' Tutorial you will be able to figure this out by yourself.
Simplest option is to edit label of that particular action in out of box property file.
You can find it under
<ALF_HOME>\tomcat\webapps\share\WEB-INF\classes\alfresco\messages\slingshot.properties
This entry
menu.select.all=All
Change label here and it will be reflected.
NOTE: It is not best way to implement this. Ideally you need to override property file and change label
The issue here is that only the items shown on the page have been loaded. This means that the metadata for the items not shown on the page won't be available. The metadata of each node is used to evaluate it's applicability to any action. If the node is locked or has had its permissions changed then it won't be possible to edit it. This is why "all" only means all items on the current page of data.

Emberjs CollectionView changes from 0.9.7.1 to 1.0.pre?

I had some code that connected an ArrayController with CollectionView that no longer works once I upgrade to 1.0.pre.
It seems that CollectionView no longer passes each element of the collection to its template view class?
I've distilled my issue to this jsFiddle: http://jsfiddle.net/chaodoze/CbwCN/
Notice it outputs to "1,2,3" on each line in 1.0.pre
In 0.9.7.1, it outputs correctly as a single digit on each line.
Am I doing something wrong here or is this a bug?
What is the best way to work-around this issue?
Thanks!
In 1.0.pre the view's context has changed. When you access {{content}} you are really accessing {{controller.content}}, which is [1,2,3]. You need to access the view's content, which in the individual number, that is done with {{view.content}}.
See http://jsfiddle.net/CbwCN/2/

restrict user to insert same component and template [duplicate]

This question already has an answer here:
Closed 10 years ago.
In a page inside the insert component popup window. When a user is trying to Select a component and a Template then how to *restrict them to select the same combination of component and template * that is already present in the component list.
I thought of writing a javascript on insert button.Please suggest if i am going in right way.
As Bart says above your question is amazingly vague, but here is an attempt at an answer as i've just done something similar. Given the vagueness, i'm assuming that you're knee deep in JS code and what I'm putting here will make sense to you :)
In your javascript you'll likely store the selected component presentation in a property as your user clicks on a given cp in the list, for example:
// keeps stock of the current selected component presentation
p.selectedComponentPresentation;
to use simply:
var componentPresentation = p.selectedComponentPresentation;
and to set you can see i get the tab control first, store the component presentationTab and from there call the getSelectedComponentPresentation():
var masterTabControl = $controls.getControl($("#MasterTabControl"),
"Tridion.Controls.TabControl");
p.compPresTab = masterTabControl.getPage("ComponentPresentationsTab");
p.selectedComponentPresentation
= p.compPresTab.getSelectedComponentPresentation();
Again I do hope this makes sense, I'm also assuming by now you'll know how to get the pageId
If you're in a Component popup window, you can get the ID of the Component through
$display.getItem().getId()
This will actually work in any Item edit popup (so Pages and other item types too).
It will not work in the main Dashboard view (so where you see the tree on the left and the list on the right), since there you don't have a single "current item".
You will have to update your question with information as to where your code is running, because that is unclear to me now. As far as I know there is no place in the Web GUI where you have both a "current Component" and a "current Page".

Resources