Hi Adam,
edit rules are executed in their own little sandbox and do not produce
output. So you cannot use them to inject <script> tags into the result page.
What I think you want to do is to add an event subscription to the event
org.topbraid.swa.change. In SWA (in your application if you have any),
this can be done similar to what swa:EditableGridGadget does:
<swa:Subscribe arg:code="swa.handleChangeForGrid(data, '{= ?gridId
}')" arg:event="org.topbraid.swa.change"/>
which amounts to a JavaScript call of swa.registerSubscription. This
gives you a JSON structure as data (inspect in the browser) with
pointers about which resources have been changed. You can then perform
side effects on the client.
HTH
Holger
On 24/03/2017 0:11, Adam Kimball wrote:
Hi all,
I am working on functionality that will notify dependent systems when
certain resources change in EVN. I've got the EditRule/CommitRule
sorting through the added/deleted graphs and now want to invoke a
javascript function for each one. A simplified snippet is:
<ui:group let:tagId="{= teamwork:currentTagId() }" let:teamGraph="{=
teamwork:currentTeamGraph() }">
<ui:if ui:condition="{= (!bound(?tagId)) && bound(?teamGraph) }">
<ui:call ui:template="hw-int-spin:ChangedAssetsTemplate" ui:varName="rs">
<ui:forEach ui:resultSet="{= ?rs }">
<ui:group let:x="{= smf:trace("{?hw_resource}")
}"/>
<script type="text/javascript">hw.notifyCacheOfChange('{=
?hw_resource }');</script>
</ui:forEach>
</ui:call>
</ui:if>
</ui:group>
The Javascript file that defines the function notifyCacheOfChange is
linked registered in ui:headIncludes via:
<ui:group>
<script src="{= ui:lib() }/hw/js/hw.js" type="text/javascript"/>
</ui:group>
Using my Javascript Console in Chrome, I see that the
hw.notifyCacheOfChange is in scope and evaluates (simple a
console.log). When I make an edit, I see the trace, but no invocations.
Further, I know the script tag approach is hideous.
It feels like I'm close but no dice yet.
Thanks for your time,
Adam
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include the TopBraid
Suite family of products and its base technologies such as
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Group "TopBraid
Suite Users", the topics of which include the TopBraid Suite family of products and
its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.