In Tritium, can I select all children of a node? - moovweb

I have a div that has several child divs. Some have ID's and classes, some do not.
I have used move_children_to() and was wondering if there is something similar to select the children.

There are a few different ways to select the immediate children.
First you can do:
$("./*") {
# code for children goes here.
}
move_children_to("..", "after)
Another way to handle this would be to just open a scope on move_children_to()
move_children_to("..", "after) {
# children code can go here.
}
I hope this helps! Let me know if I can provide any more assistance.

Related

Get element position in ZStack

Cheers everyone,
For the past couple of days I have been trying to find a way, to identify elements within a ZStack.
File structure
ZStack {
foreach { element in
SubView(element)
}
}
I always have 3 elements stacked on top of each other & really want to get the top most element, to be able to edit some properties.
Any solution to this? Any help is appreciated.
Thanks!
Found the solution to this specific case
Background:
The View that is being loaded in the loop is in an array, that I previously created. The array also contain an ID.
What I did now was to find out the max ID, reverse loop through my array while passing the current ID and the current max ID to the new view, where I can handle the data accordingly.
So if the max ID == currentElement ID, I can apply my changes, thus also getting the topmost card.

Expanded/Collapsed List section at startup

I am struggling to get all the sections of a List collapsed by default. My goal is to create these sections statically(no nested arrays) and prevent them to display expanded by default.
List()
{
Section(...){}
Section(...){}
}
Found the answer. It's the DisclosureGroup, in case someone needs it.

Changing node icon to "folder" when adding child in fancyTree

It seems to me that the standard behaviour in fancyTree, when adding child nodes is NOT to change the parent node to have a folder icon.
For example, see http://wwwendt.de/tech/fancytree/demo/index.html#sample-multi-ext.html and try adding a child node.
How is it possible to dynamically change the icon of the parent to a "folder" when adding a child?
I thought that I could apply renderTitle() to the parent node, but this did not do anything.
This question Dynamically change icon in fancy tree is similar, but (a) I could not get it to work, and also (b) I wanted a solution that didn't involve having to create new icons.
Folders may be empty, so this status is defined by node.folder = true (not by the fact that children are present or not).
So you could set node.folder and call node.render().
Note that setting an additional class may give the same effect, but may get lost when the tree is updated.
In jquery.fancytree.edit.js I added the following line
newNode.parent.addClass("fancytree-ico-ef");
The code snippet is as follows:
newNode.makeVisible(/*{noAnimation: true}*/).done(function(){
$(newNode[tree.statusClassPropName]).addClass("fancytree-edit-new");
self.tree.ext.edit.relatedNode = self;
newNode.parent.addClass("fancytree-ico-ef");
newNode.editStart();
});

How to get descendants of a panel in teststack.white

I need some elements that are the childs of some 3-4 panels, but in those panels I can identify only the 1st parent panel and rest don't have any identifiers, so please help me to find the descendants of the 1st parent panel.
let's say - Parent#1 only can be identified as "workspace" but the immediate child panels are not detectable (Edit#1/ Edit#2 and button under unknown panels are identified), so i want to reach to the edit boxes, please help?
Try this
Use SearchCriteria to find the parent Panel1
Use the GetElement method in TeskStack.White.UIItem:
Panel1.GetElement(SearchCriteria searchCriteria)

How to query the child views of a parent view using Titanium?

I am looking to create a general purpose routine that will operate over a view's children. Within the routine I need to be able to iterate over the child views. I don't see anything in the API that would suggest that there is any way to get the child views. There is an "add()" and a "remove()" method but nothing like "get()" nor does there appear to be any properties like "views". What am I missing?
this is the basic structure for removing child objects from a view
if (view.children) {
for (var c = view.children.length - 1; c >= 0; c--) {
view.remove(view.children[c]);
}
}
i would check also for
if (view.children[c] !== undefined) {..}
since i already got problems with android without verifieing.