Holger Knublauch

Added onLoaded event to tree

......@@ -5828,6 +5828,13 @@ app:Tree
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "An optional JavaScript snippet that is to be executed after the tree has loaded its roots."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:onLoaded ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "JavaScript code that shall be called if a node has been selected in the tree. In this code, the variable 'resource' points to the URI of the selected resource. The variable 'node' holds the selected low-level tree node."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:onSelect ;
......@@ -7775,6 +7782,11 @@ arg:oldElementId
rdfs:label "old element id"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:onLoaded
rdf:type rdf:Property ;
rdfs:label "on loaded"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:onSelect
rdf:type rdf:Property ;
rdfs:label "on select"^^xsd:string ;
......
......@@ -403,8 +403,9 @@ function appResizeGrid(pane, $Pane, paneState) {
* Will expand if necessary, using a server-side shortest path algorithm.
* @param treeId the id of the tree
* @param nodeURI the URI of the resource to select
* @param queryGraphURI the result of calling ui:currentQueryGraph()
*/
function appSelectTreeNode(treeId, nodeURI) {
function appSelectTreeNode(treeId, nodeURI, queryGraphURI) {
// TODO: Currently this only works on the Tree that was created last
// but not if multiple trees are on a page
......@@ -428,6 +429,7 @@ function appSelectTreeNode(treeId, nodeURI) {
// Load path to root from the server and then call helper function
var data = {
_base: '<' + queryGraphURI + '>',
_format: 'json',
_viewClass: 'app:TreeShortestPathCallback',
dataProvider: '<' + dataProviderURI + '>',
......
......@@ -50,5 +50,11 @@
});
</ui:if>
<ui:if ui:condition="{= bound(?onLoaded) }">
$("#{= ?id }").bind("loaded.jstree", function(event, data) {
{= ?onLoaded }
});
</ui:if>
</script>
</ui:createLink>
\ No newline at end of file
......