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
Related
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 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
We have a java program that takes a CSV file and processes it into multiple sets of data. The data is displayed one at a time on an XYChart with a ComboBox to choose between them. However we keep running into problems updating / changing the data:
First we had a bunch of ObservableList objects for each data series, e.g.
ObservableList<XYChart.Data<T,V>> data = FXCollections.observableArrayList();
and whenever the ChoiceBox selection was changed we would clear the series and add the one corresponding to the different selection, e.g.
theChart.getData().clear();
theChart.getData().add(new XYChart.Series<T,V>(data));
However, we would get errors when data was updated saying something about same data added to multiple charts. I think this would occur if theChart.getData().add(new XYChart.Series<T,V>(data)); had been called twice for the same data beforehand.
So I wrapped it up like
XYChart.Series<T,V> series = new XYChart.Series<>(data);
and changed the chart data like:
theChart.getData().clear();
theChart.getData().add(series);
Works fine on my computer but on another when data is cleared and then added to we get a null pointer exception during the series onChanged event, which suggests some kind of race condition.
Questions:
What is the proper what to change the series that a JavaFX chart is displaying?
Is there a way to 'pause' onChanged events so that an entire data series can be updated before the chart tries to redraw.
You can't do a clear(), that will throw an UnsupportedOperationException. The proper way to update the chart is setting a new empty ObservableList and then add the new XYChart.Series with the proper XYChart.Data objects into.
chart.setData(FXCollections.observableArrayList());
XYChart.Series<T, V> series = new XYChart.Series<T, V>();
XYChart.Data<T, V> data = new XYChart.Data<T, V>(t_type_Value, v_type_Value);
series.getData().add(data);
chart.getData().add(series);
I am trying to expand a node(model bean) using the below command
gmisRevenueGross.setExpanded(revenueGrossBean, true);
but I get the below error
java.lang.AssertionError: null
at com.sencha.gxt.widget.core.client.treegrid.TreeGrid.setExpanded(TreeGrid.java:673)
at com.sencha.gxt.widget.core.client.treegrid.TreeGrid.setExpanded(TreeGrid.java:644)
The same code when I put inside a handler of button, I was able to expand the node. So I guess I am trying to expand before the dom is loaded. So is there a way to expand some nodes soon after adding it to store. For grid.setAutoExpand(true) works fine, but that expands all the node.
Just guessing, are you using GXT version 2? I think your problem was because you tried to expand the tree node before the tree grid was rendered. Check your code and make sure your tree grid was already rendered before expanding the tree node. Post your code so I can help you better.
I'm looking for a widget which can be dynamically resized. I need to append and remove rows.
There are a methods coming with Grid, like gtk_grid_insert_row or gtk_grid_insert_next_to, but I don't find any xxx_remove_xxx method.
I'm developing a simple http client (to test an api). And I'm adding the possibility to append and remove "GET" variables dynamically.
The UI is made with rows containing a combobox (for variable selection), an entry (for its value) and on the last row a remove button.
Every time I set a variable, a new line (new available variable) is appended.
And every time I unset a variable, the corresponding line is removed.
thanks.
Gtk.Grid doesn't have a remove method; but Gtk.Container does. Since Grid is a Container, you can use gtk_container_remove.
The docs for this are here:
https://developer.gnome.org/gtk3/3.8/GtkContainer.html#gtk-container-remove
I think the widget you are looking for is Gtk.ListBox. It's a container so you can add and remove rows easily.