-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello everybody!
I am trying to implement a ZK8 MVVM proyect with Polymer, but I have had some troubles with the binding.
When I try something like this:
<h:paper-input id="my-paper-input" value="@load(vm.test) @save(vm.test)" xmlns:h="xhtml"></h:paper-input>
The web component works well and I have no problems with the @load and @command bindings, but I can't make @save binding work.
The only example that i've found of ZK and Polymer use this:
<n:script>
zk.afterLoad(function() {
jq('#cal').on('d-calendar-date-selected', function(evt) {
var selDate = evt.originalEvent.detail.date;
zkbind.$('$cal').command('doDateSelected',
{date: selDate.getDate(), month: selDate.getMonth() + 1,
year: selDate.getFullYear()});
});
});
</n:script>
and actually I am able to reproduce it, but for my project I need to use a @save binding like by default, to use Javascript to send data to view model (like the example) is not an option to me.
Is there any way to do that? or any way to configurate bindings between ZK and web-components (not ZK components)?
p.s. Sorry about my english.
Because save binding is triggered by a ZK event e.g. onChange
for Textbox
, xhtml component doesn't fire onChange
event so save binding doesn't work on <h:paper-input>
.
If you don't prefer to use javascript, you can consider using <fragment>
. It allows you to use save binding on native HTML elements. Please check:
Asked: 2018-07-28 06:03:48 +0800
Seen: 11 times
Last updated: Aug 01 '18
MVVM Validator: class not found ? [closed]
Conditional evaluation component in mvvm
Children Binding : UiException Callable only in the event listener
Attributes in macro was not updated after notifyChange
Problem binding values to a composite component
How to access static member field of a class in zul without zscript
How can i load a constant in .zul
You always need js to send the data out. Even zk components do that with JS. Why is JS not an option?
chillworld ( 2018-07-29 15:35:29 +0800 )editThank you for yor help! I need to migrate a big legacy project from ZK7 to ZK8 (with new frameworks) and I am finding out how to make the job easier and faster for the team, the legacy project have no components and don't use js to save data
IsmaelGC ( 2018-07-30 21:39:31 +0800 )editI think datahandler would be an option. You write the Bindings once and then you create your component from it. Like that it's transparent in all zuls
chillworld ( 2018-08-01 03:52:41 +0800 )edit