Comments (4)
You can be alerted of the click event by changing the ivhTreeviewOptionsProvider
to change the leaf twistie template. Here's an example.
Currently there's no documented way to get at which item was clicked (in my example I point out a workaround if you truly need it). We plan to give proper hooks in the future (registering callbacks, directive stubs, etc.) so I wouldn't expect that capability to go away but the specific supported mechanism for figuring out which item was clicked may change.
from angular-ivh-treeview.
Yes, I really need it, because I have to grab some data from a third party API asynchronously.
The solution in your example is terrific, but here's further question according to this one:
app.directive('leaf', function() {
return {
restrict: 'AE',
link: function(scope, element, attrs) {
element.on('click', function() {
alert('OHAI');
// It's not ducmented and may change but if you **really**
// need it scope.node is available:
// Sure, I won't ask for help without reasons :)
// For example, when API returned a new Array,
// How to add it to the tree dynamically?
// I tried this one but nothing happened.
scope.node.children = [{
label: 'IComeFromApi',
children: []
}];
// ```
console.log(scope.node);
// ```
});
}
};
});
from angular-ivh-treeview.
Ah, unfortunately we aren't set up to handle dynamic changes to the tree. I'd encourage you to open a new issue for the feature though.
At present the best you could do is manually force a recompile on the tree or part of it. Here's a hacked together demo using ng-if
. Obviously this is far less than desirable for a number of reasons. A true solution would probably involve setting up watchers in ivh-treeview-node
and just recompiling that branch when something changes.
from angular-ivh-treeview.
My boss'll be happy next week, your temporary solution works fine but not perfect as you said, thanks so much for everything 👍
from angular-ivh-treeview.
Related Issues (20)
- ivh-treeview-children-attribute does not override default config HOT 5
- Remote data bindig HOT 3
- Binding children on promise resolve does not update UI HOT 2
- Disable collapse / expand HOT 1
- When using the checkbox, ivh-treeview-on-item-selected has no effect HOT 2
- How to set the selection can only be changed by clicking on the checkbox HOT 3
- How to change root node dynamically HOT 4
- Does not support tristate properly HOT 5
- On the selection status of the parent node HOT 2
- All subNodes been checked when parentNode been checked HOT 1
- JSbin demos HOT 3
- can we ban the root checkbox? HOT 1
- Disable Twisties & Deselect all children of a parent! HOT 1
- Get Selected Nodes Paths HOT 1
- Performance Improvement - Pop vs Shift HOT 1
- Nothing is being selected.. HOT 1
- select and deselect all method doesn't work on customized children HOT 1
- List Items from Server and apply CSS to specific parents HOT 1
- when data is changed,How to make the check boxes of all nodes unchecked, just like the initial load HOT 1
- how to click on one item, close the other items HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-ivh-treeview.