-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Zul:
<window ... apply="org.zkoss.bind.BindComposer" viewModel="@id('vm')
@init('de.oxitec.zkboost.websocket.webrtc.OXWebsocketWebRtcVM')">
<div id="divRemoteVideo" visible="false" style="overflow:auto;"
onMyEvent="@command('createVideo',
parent=event.data.parent,
username=event.data.username,
src=event.data.src)">
<!-- some stuff here -->
</div>
Javascript:
// Fire an event to the ViewModel.
function myFunction(){
var widget;
// Get ZK widget
widget = zk('$divRemoteVideo').$();
// widget fires SELF-DEFINED event
widget.fire('onMyEvent', {
// sample params to send to ViewModel
parent : 'divRemoteVideo',
username : 'TerryTornado',
src : URL.createObjectURL(stream)
}, {toServer : true })
}
ViewModel:
@Command("createVideo")
public void createVideo(@BindingParam("parent") String _parent,
@BindingParam("username") String _username,
@BindingParam("src") String _src) {
// your code here
System.out.println(_parent + " | " + _username + " | " + _src );
}
Attention: Such things are not safety. Every guy can open your js file and call such a function.
best Stephan
PS: I take votes :-)
Asked: 2015-04-23 10:44:56 +0800
Seen: 25 times
Last updated: Apr 23 '15
Facing issue in masking on phone [closed]
coerceFromString_ override no longer works from 6.5.1 [closed]
Execute Javascript on component visible
Is there a way to resolve view model properties as input to client side javascripts?
scrollbar listner for 2 grid [closed]
Theme javascript wpd file not found