Attempt to get node but dynatree tree don't reload completely yet - dynatree

Everybody hi
Have such script template
tree.reload()
tree.activateKey();
so, it reloads tree and then get focus for special node.
But get such situation - activateKey starts when tree is reloading and don't get node we need because it doesn't load yet...
how it could be fixed? how launch activateKey when tree guaranted reloaded completely?

You could try to call activateKey() in the onPostInit event.

Related

Vue HMR only works for changing to existing DOM nodes, doesn't update when node added/removed

I've been using the included Hot Reload in Vue since starting a project, but it has randomly stopped working. At the moment, changing to existing nodes work (e.g. adding/removing a class, updating text), but adding or removing a node doesn't rerender.
After watching the WS connection, I can see the update hash is received every time, and the script is loaded successfully. Setting a breakpoint on webpackHotUpdate shows it executes normally every time.
If a node is added or removed, forcing a re-render (changing page/tab/resizing the browser) causes it to show successfully, suggesting the issue could be some kind of module cache?
I'm lost here, and don't know enough about Vue internals to track it down. Any ideas?

How to select a single line from a leafletjs polyline when clicked?

I have a leaflet map (using Vue and vue2-leaflet) with many predefined nodes and connections between them (stored in a neo4j database). When the user clicks on a node (#mouseup, actually), all its connections are shown as a polyline. I want to be able to click on any of these connections on the map (the lines) and do stuff with it, like delete for example (there would be a popup or something with actions, but that's not important here).
The problem I'm having is that the click event doesn't record the connection ID (or anything that would identify which connection was in fact clicked). I could of course create one polyline for each connection, but I suspect the problem would persist, and it's not a really solution in my case, as I don't know how many connections each node has, and v-for doesn't seem to work with polylines (at least I wasn't able to make it work).
This is the nodes markers code:
<l-marker v-for="mapNode in MapStore.mapNodes"
#mouseup="nodeClick($event, mapNode.index)"
:lat-lng="[mapNode.latLng.lat, mapNode.latLng.lng]"
:key="mapNode.index"
</l-marker>
... and this is the polyline code:
<l-polyline
#mouseup="connectionClick($event)"
:lat-lngs="MapStore.selectedConnections.latlngs"
/>
The nodeClick function populates the MapStore.selectedConnections correctly as the polylines are shown as expected.
The problem is that I don't see anything being passed to the connectionClick function that would identify which connection was clicked, so that I could work with it.
Is that even possible?
Ok, so it turns out I was wrong and v-for works (there was something wrong with my code, I think, but I'm not sure what).
My solution is:
<l-polyline v-for="connection in MapStore.selectedConnections.latlngs"
#mouseup="connectionClick($event, connection)"
:lat-lngs="connection" />
This way it iterates through the connections, generates a separate polyline for each and passes to the connectionClick function the latlngs of the clicked connection.

Vue 2 Check Element Whether Visible on Viewport

I am trying to research about vue2 and wondering if there is any way that can make it easy to track if elements are visible on viewport or not so that we can do something like slide-in boxes when we scroll down the page. Any npm package or whatsoever that can be suggested? Thanks.
Currently using Vue-observe-visibility (https://github.com/Akryum/vue-observe-visibility) and have not stumbled on any issues yet.
The only thing to consider is that this only triggers when the element enters/exits the page by user scroll, not when it enters/exists because of DOM changes. Looks like it shouldn't be an issue for your use case, based on what you told about it.
Certainly check it out, it's easy to use!
vue-waypoint could be an option.
GitHub
NPM

Safari Web Inspector - any way to return to selected element on reload

Is it possible to have the Safari web Inspector retain the position that the DOM tree is expanded to?
At present, you expand the DOM tree to an element and then as soon as the page is refreshed the entire DOM structure is collapsed again necessitating drilling right the way back to the original element.
I saw this post on the subject a couple of years back but the code has now changed so it doesn't apply.
I have also opened a bug report at the WebKit bug tracker.
That bug ended up getting fixed: https://bugs.webkit.org/show_bug.cgi?id=121665

How to highlight a specific tree node in xpage programmatically?

I have a dijit.tree in xpage. I want to select a specific tree node when the page is rendered.
In dojo reference guide,There is a example contains workaround code for this problem, as well as an example call to tree.attr('path') if you already know the full path to the tree node you want to highlight. But i want to highlight the node automaticlly when the page is rendered.
What's the more idiomatic way of doing this? Thanks a lot!
You can add a XSP.addOnload(function(){....}) call in an Outputscript element to render the highlight.