Using App Connect with JavaScript Functions

The problem is that I need to render the translation immediately or the user will see no text. Also even though somehow related it’s not the same situation as I’m not waiting data from the server. It’s all on the client side.

1 Like

Easier than I thought. As the expression is already enclosed you just need to reference the var value

{{ "key".t({ what: name.value, count: count.value }) }}

No need to parse the variable.

3 Likes

I’m a bit confused… how can I set the value of my dmx variable from javascript function.

image
This is not working for me.

function scrollpos() {
var y = $('#transactions').scrollTop();
dmx.app.set('transactionscroll', y);

}

Also I have jQuery installed, it’s working fine for other functions.

Oops nevermind I got it now

dmx.parse('transactionscroll.setValue(' + y + ')')

6 posts were split to a new topic: Using app connect values in js functions

@patrick Would it be possible to create a new doc like this for AC2?
There are many JS scripts in the comments and other posts along with the original post. Maybe all can be complied in a new single doc post?

All the above samples should still work with App Connect 2. I posted a post in the docs for building App Connect extensions about thee changes in the API for App Connect 2.

The biggest thing is the deprecated dmx.requestUpdate() method. Other changes are in the API for custom components.

Also as a sidenote I want to point out that using dmx.global.set('transactionscroll', y); instead of dmx.app.set('transactionscroll', y); is prefered since the app instance is only available after the doc is parsed and global is directly available.

2 Likes