Javascript to Bubble element - can't it be in a repeating group

I need to convert a unix timestamp to a string. I thought that I could use the Javascript to Bubble element.
I followed the tutorial & I was able to convert the timestamp to a string.

However I have a repeating group & each cell in the group has a timestamp. If I embed the element in a repeating group it doesn’t work. I have 3 cells in the repeating group & only the 3rd cell gets updated with the timestamp string.

Any ideas how I can get it to work?

Interesting, I hadn’t thought of it being used in a repeating group. The problem is that the function name is static, so each element has the same function name. The last one to define the function gets to keep it.

I could change the function name property to be a dynamic value, so you can put in something like the current cell’s index.

In the meantime, if its just the conversion you want, can you retrieve the timestamp using an Expression element instead?

@grehancl I published a new version of the toolbox, with the fix to have dynamic values in the function suffix.

Example page: example app editor

5 Likes

Thanks for the really quick update & response
I didn’t realise the Expression in the Toolbox plugin can handle Date.
I used that & it worked perfectly.

I’ll keep the new Javascript to Bubble element for something else.

1 Like

Mishav,

This works great. It seems that it’s still not possible inside a reuseable element correct?

Hi @aliandrihab,

It can be in a reusable group, just a bit more effort setting it up so each one has its own suffix.

Here is an example of one way to set it up:

The reusable element:

  • has its group value set to text and used to create a distinct function suffix.
  • contains the javascript calling the function.
  • handles the event.
  • uses the return value.
  • sets a custom state on its group to expose the return value to the main page.

app editor
runtime

Hi! Can you explan the process to implement te JS to bubble in the repeating group? I did not understan de HTML element. I would like to use “curren cell thing” filter in the “do a search for” in the JS editor. It is possible? Thanks in advance :slight_smile: