writer-framework icon indicating copy to clipboard operation
writer-framework copied to clipboard

Update Repeater docs to explain use of dynamic accessors

Open ramedina86 opened this issue 1 year ago • 0 comments

          How is this supposed to work? Is this JUST for the binding of components to items in the repeated items.

Using your example from the docs (hint...you may want to update the docs for this use)

articles[itemId].colour

Could be bound to some dropdownselect or some other input, so a user could SET the colour to some value and it will be updated in the state for "articles"?

For display we still use

@{itemId.colour}

Could be somewhat confusing to use two separate notations, but I guess the point for this is that now you could do something like

otherstate[itemId].someattribute

and set an attribute in some other state item, here now "otherstate".

ss.init_state({
    "articles": {
        "Banana": {
            "type": "fruit",
            "colour": "yellow"
        },
        "Lettuce": {
            "type": "vegetable",
            "colour": "green"
        },
        "Spinach": {
            "type": "vegetable",
            "colour": "green"
        }
    },
    "order_list": []
})

Originally posted by @thondeboer in https://github.com/streamsync-cloud/streamsync/issues/26#issuecomment-1751594014

ramedina86 avatar Mar 06 '24 18:03 ramedina86