Custom Client Side Formatters Issue

Hello @Teodor ,
I need add new client side formatter .

dmx.Formatters('string', {
    encodeBase64: btoa,
    decodeBase64: atob
});

usage ;

{{'Hello world'.encodeBase64()}} or {{testData.encodeBase64()}}

returned result ;

how can I fix this issue ?

That’s already explained in the following topic:

yes I’m trying the example there, but I get an error.

@Teodor
could you check test file ? . where is my mistake
test.zip (946 Bytes)

try the following code

dmx.Formatters('string', {
  encodeBase64: function(val) {
    return btoa(val);
  },
  decodeBase64: function(val) {
    return atob(val);
  }
);

Thanks @patrick but returned error ;

<script>
		dmx.Formatters('string', {
      encodeBase64: function(val) {
        return btoa(val);
      },
      decodeBase64: function(val) {
        return atob(val);
      }
    });
	</script>

Seems I made a typo, a curly bracket is missing.

dmx.Formatters('string', {
  encodeBase64: function(val) {
    return btoa(val);
  },
  decodeBase64: function(val) {
    return atob(val);
  }
});
1 Like

@patrick thank you working perfect !