How to expand a single sap.m.Tree item multiple levels? - sapui5

How to programmatically expand the only single node in sap.m.Tree control? JSONModel.
In example
http://embed.plnkr.co/jb9tggpFhv4DHg69785v/
Here I want to expand only node 1.2.1 without expanding all unneeded nodes.

in your sample add this line :
oTree.onItemExpanderPressed(oTree.getItems()[1], true)
after the oTree.place
This will expand the second item

To expand one or more tree nodes programmatically, try the API sap.m.Tree#expand:
var selectItemIndex = oTree.indexOfItem(mySelectedItem);
oTree.expand(selectItemIndex);
Sample: https://sdk.openui5.org/entity/sap.m.Tree/sample/sap.m.sample.TreeExpandMulti

Related

ag-grid Master/Detail apply external filter to detail grids

I have several ag grids I'm working with that are setup as Master/Detail. I have an external filter setup on the master and that works fine I can extend it to the detail grid but running into a couple issues:
The filter appears to only apply to expanded nodes. Closing and reopening resets the data, though the filter may still have a value.
I haven't figured out a way for the filter to ignore the master if the filter matches detail but not the master.
How I expand the master where the detail matches. I think I will need to use a a timeout so that the grid isn't expanding and collapsing on each key press, but I don't know how to know which grid has matching data.
The code below is what I have so far for just handling the detail grid but this appears to be very slow (plunker: https://next.plnkr.co/edit/S1PNvugCbjPh55jI).
onFilterTextBoxChanged() {
// this.gridApi.setQuickFilter(document.getElementById('filter-text-box').value);
this.gridApi.forEachNode(function(node) {
console.log('node.detailNode', node)
node.gridApi.forEachDetailGridInfo(function(detailGridApi){
console.log('detailGridApi', detailGridApi);
detailGridApi.api.setQuickFilter(document.getElementById('filter-text-box').value);
})
});
}
Just a suggestion, on each keypress event happening on the filter box ->
1) Before calling quickFilter function, Expand all the detail grid using grid event expandOrCollapse because it somehow does the filtering while its in expanded state.
2) Collapse the grid when search filter box is empty and have cross mark to empty it.
Please ignore if it does not suits ur needs. Thanks!

Are collapse all and expand all functionality provided by EA

Is it possible to programmatically collapse and expand the tree view of the project browser in EA?
To show an item use
Repository.ShowInProjectView (object Item)
So if you want to expand a package view you need to issue the above for the first element in a package. To expand more (recursive) you need to do that for all first leaves of nested packages/elements.
To collapse a view you need to issue
Repository.RefreshModelView (long PackageID)

Is is possible to use TileContainer for GenericTile in sap ui5

I have two Generic tiles and showing those tiles in two different panels.
Please check the code here -
http://plnkr.co/edit/3k17wthvl88UmVeszWu0?p=preview
now I want to show those Tiles inside a tile container. I tried -
var oContainer = new sap.m.TileContainer({});
oContainer.addTile(Tile1);
oContainer.addTile(Tile1);
this is not allowed.
is there any way I can put those generic tiles inside a tile container.
Or how put those tiles side by side in one panel.(note: when I tried one panel, Second Tile is coming below)
You have different options if you want to stick to sap.suite.ui.commons.GenericTile you can use any layout like HorizontalLayout, MatrixLayout and so on
But if you want to use sap.m.TileContainer, you have to add tiles, which inherit from sap.m.Tile (as you can see here https://sapui5.hana.ondemand.com/explored.html#/entity/sap.m.TileContainer/aggregations)
I forked your example: http://plnkr.co/edit/Gh46xYK66ii1J3O69j3q?p=preview

Fancytree update tree with new data

I've been trying to use reload() to update the tree to new data but the whole tree reloads which is not wanted. Just want that the nodes get updated with the new data which will contain child data for the nodes. I do not want to reload the whole tree insted i want to keep the current nodes that I've expanded.
New to fancytree, any help is appreciated.
This worked for me:
var rootNode = $(el).fancytree("getRootNode");
rootNode.removeChildren();
rootNode.addChildren(newTreeData);
You can use node.load(); This is applied to a single node, so you'll need to loop through all nodes you want re-loaded.
The load function is explained here: http://www.wwwendt.de/tech/fancytree/doc/jsdoc/FancytreeNode.html#load

Multiple Selection QTreeWidget

Does anyone know if its possible to select multiple items on a QTreeWidget and how to go about enabling the multiple selection?
All the items I want to be selectable are top level QTreeWidgetItems and all their children are set to be disabled (i.e QTreeWidgetItem.setDisabled(True) )
It is, you'll want to call setSelectionMode during init to enable QAbstractItemView::MultiSelection. QTreeView/QTreeWidget inherit QAbstractItemView, so it is available.
Then to disable the items, just hook on to QTreeWidgets.itemSelectionChanged() signal.
I think below will help:
youQTreeWidget.setSelectionMode(QGui.QAbstractView.MultiSelection)