0

Save binding with a Polymer's web component

asked 2018-07-28 06:03:48 +0800

IsmaelGC gravatar image IsmaelGC
1 1

updated 2018-07-28 06:15:27 +0800

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.

delete flag offensive retag edit

Comments

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 )edit

Thank 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 )edit

I 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

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-01 14:43:54 +0800

hawk gravatar image hawk
2255 1 5
http://hawkphoenix.blogsp... ZK Team

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:

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2018-07-28 06:03:48 +0800

Seen: 10 times

Last updated: Aug 01

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More