DMXzone App Connect Support Product Page

Solved

Problem with onclick event

Reported 13 Mar 2017 05:49:23
1
has this problem
13 Mar 2017 05:49:23 Ben Pleysier posted:
Using Data Bindings I have the following markup

<a href="www.youtube.com/watch?v={{DiscussionVideo}}" title="Video Link" class="btn btn-manila" data-toggle="tooltip">

When I click the link, the onclick event listener runs this piece of script

$('a[href^="www.youtube.com"]').on('click', function (e) {

The script then runs the video within a modal.

All of this works well.

Now I try this using App Connect

<a title="Video Link" class="btn btn-manila" data-toggle="tooltip" dmx-bind:href="www.youtube.com/watch?v={{DiscussionVideo}}">

and it bypasses the event listener. In fact, it even ignores an onclick event attribute placed in the anchor tag.

Replies

Replied 13 Mar 2017 07:29:16
13 Mar 2017 07:29:16 Teodor Kuduschiev replied:
Hello Ben,
Is your script, which adds the onclick listener loading on document ready? Most probably that is the issue, as it is being loaded, before the repeat region is fully rendered. Please provide a link to your page, where we can check what are you trying to achieve.
Replied 13 Mar 2017 22:07:41
13 Mar 2017 22:07:41 Ben Pleysier replied:
This is the working model using Data Bindings

bunchoblokes.org/teodor/index?id=1

The script is loaded with scripts.js. A non-minified version is at

bunchoblokes.org/teodor/myscripts.js
Replied 14 Mar 2017 08:01:41
14 Mar 2017 08:01:41 Teodor Kuduschiev replied:
Okay but can you send a link to the page with app connect also?
Replied 14 Mar 2017 12:55:05
14 Mar 2017 12:55:05 Ben Pleysier replied:
Did not filter this, the markup is similar

bunchoblokes.org/teodor/index1
Replied 14 Mar 2017 20:47:13
14 Mar 2017 20:47:13 George Petrov replied:
Hi Ben,

You should use the new App Connect - Dynamic Events to place events. Those result in dmx-on:click="..." attributes.

Normal events normally should also work but as you are search for an a tag with specific href - that is not rendered yet - you won't find it. So if you insist to do jquery binding - just give the A tag an ID and do a #theid selector. Like: $("#theid"....

Greetings,
George
Replied 15 Mar 2017 06:08:46
15 Mar 2017 06:08:46 Ben Pleysier replied:
Thanks George,

I could not get the the new App Connect - Dynamic Events to work.

To make it work I used the Static Events together with the dmx-bind:data- attribute

You can see the result at

bunchoblokes.org/teodor/index1

Great extensions! Please keep them coming.

Reply to this topic