jake
(Jake Walters)
December 7, 2020, 11:43am
1
Hello all,
Currently when creating a Slice, the model only allows for an array which sets the same label and value for each option.
Is there a way to separate the option name from value?
for basic example
"options": [ "Red #FF0000", "Blue #0000FF", "Green #00FF00" ]
Could become:
"options": [ {"Red": "#FF0000"}, {"Blue": "#0000FF" }, {"Green": "#00FF00"} ]
We then wouldn't need the hex value in the label for that option.
The first version works but requires some front-end splitting to get the desired value or a matching function. I can see this become complicated when dealing with larger options.
Thanks
Jake
Phil
(Phil Snow)
December 7, 2020, 11:49am
2
Hi Jake,
We're tracking this as an open feature request here:
Hey Srini,
At the moment it isn’t possible to define a label and a separate value. The @features-team have an open feature request for this, if/when we ever make a change to this behaviour we’ll update you in this thread.
For now you will need to build the values into your website application. Sorry for the inconvenience.
One solution might be to add values like:
Downtown warehouse [33]
Then in your project use regular expressions to get only numbers inside the brackets:
or js slice to …
But for the moment frontend splitting like you suggested is the only option.
1 Like
jake
(Jake Walters)
December 7, 2020, 12:01pm
3
Hi Phil,
Thanks for getting back to me about this so quickly, much appreciated.
1 Like
Phil
(Phil Snow)
Split this topic
August 30, 2023, 12:20pm
7