Forum Academy Marketplace Showcase Pricing Features

How to change list custom state at current cell's index

Building a meeting suggestion widget. Input the number of pages in a book, the pages to read before each meeting, and the starting date. From there I generate a list of dates and display them in a repeating group. I also have a date input in each repeating group cell in case you want to modify one of the dates by a day or two (i.e. the scheduler suggests a meeting on a Sunday, you want to move it to Monday).

When the user uses that date input to change one of the suggested meeting dates. I want to update the underlying custom state with the new date and remove the old date. - If I do this with one state, I get the undesired behavior where the date disappears and the new date gets added to the end of the list (i.e. if there are 3 meetings and I change the middle meeting date, then the new date is the 3rd meeting in the list, not the middle (2nd))

I’ve tried to use the JavaScript to Bubble plug in as suggested in this thread but it is just not working with dates for some reason, seems to only work with numbers.

So my question is how can I do this? I basically want to say initial_dates[index of current cell] = newDate and then display the changes. - If the javascript thing was working this would be possible.

Are there any other ways to modify a list state by index value from a repeating group?

Figured out how to do this in case anyone has the same problem:

First create custom states for current cell index - 1 and then current cell index + 1
Then use item until # and item from # with those indices to break the existing list into 2 pieces and save those into their own states
Then delete the item at the current cell index from the list by looking up the item at that index using item #
After that, add the new value to the first list and then append the second list and boom, in place change of the state.

This topic was automatically closed after 70 days. New replies are no longer allowed.