New Components: Variables of component initial value not bindable

Unfortunately the more I try to work with components I fail on the simplest things…

You can’t bind an initial value of a component variable? Really or did I just not find it…

image

I’ve actually mentioned this in previous my thread on the forum.

There is also a sort of answer.

2 Likes

I read your thread yes but it was not obvious that it won’t work on all variables.

Weweb works very well but to be honest at the current time the components are completely useless for me. Even to make a custom accordion is not possible with these limitations…

What keeps you from making a custom accordeon?

Another workaround was my idea to change the properties of a component from inside the component but you can’t change properties from inside :frowning: mybe this is even correct not to overwrite external inputs but with these limitations I would still need an external global variable just to control a accordion which is a big bummer…

I think about forgetting components until they are kind of usable…

I want a collapsable element. These are in a repeater. It simply hides/shows an internal other div by changing an internal variable “opened”

So far so good. Manually open and close the element works by change opened variable on click of a button and display the other button.

But I also wanted to control the opening state from outside as if a user adds a new element It should open the container by defaut. For that I created a property “opened_external” to control the state from outside.

But then I can’t control it manually any more.

I can bind the open state to: opened || opened_external
But I can’t bind the visibility of the show/hide buttons to that behavior:

one button shows on : opened || opened_external
but the other button has to show on: !opened || !opened_external which is wrong

And I can’t change the parameter on an internal workflow to get rid of one variable. And I can’t change the internal variable to the property as I don’t have the possiblity to bind the default value of the variable to the property…

Yes the task is simple. A collapable container as a component that can be controlled manually and from outside.

Not possible as it seems…

With component actions it would be no problem. But there I also would need to access a component action in a repeated component. Same with exposed variables. I would need to change a repeated external exposed variable…

Before I hat the openeing state of the container in an global state array. So it was no problem to control it manually and by logic. But it is simply not good to have global variables for so many elements…

As least I get it kinda working:

“but the other button has to show on: !opened || !opened_external which is wrong”

!(opened || opened_external) works

still a hassle :slight_smile:

And I am in front of the next problem not able to change the opened_external parameter on the inside after the user saved the element… grrr… therefore I would still need a global state… mäh…

I give up and work without components and keep going with global states…

You can still use components for design consistency and productivity even though not all logic can be solved with them yet. We are listening to the feedbacks and will be adding more functionalities to build these complex components

2 Likes

Indeed…
I would not say such a component is complex, its pretty simple but anyway I am looking forward to the component features of the future…