Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array of arrays #19

Open
sanuann opened this issue Jan 15, 2021 · 1 comment
Open

array of arrays #19

sanuann opened this issue Jan 15, 2021 · 1 comment

Comments

@sanuann
Copy link

sanuann commented Jan 15, 2021

by using this package, is it possible to have two fields on each row in the array? I mean when I click on "add new", it should add two text boxes on the same line(say, "name" and "value").
if this is doable, please let me know how to.
Thanks.
@gwenaelp any idea how to do this?

@gwenaelp
Copy link
Owner

mhhhh, there is a way you can do it with css, but you might have to experiment a little bit. One other way would be to make an array of objects, and use my other "vfg-field-object" project. In advance, sorry, i know these projects don't have a perfect documentation... But I think if something is lacking you may be able to understand the source code easily. It's basically one vie component for both projects.

Anyway, what you can try :

  • keeping array of array way of thinking : try to deal with the problem with css : first array elements are blocks, inner elements are inline-blocks. You can also use "itemContainerComponent" property to add a wrapper components to your array elements.

  • with an array of objects, using vfg-field-object. the JSON generated would be something like :
    [{a: 1, b: 2, c: 3}, {a: 4, b: 5, c: 6}]

After that, you can also convert your object into an array before using it for something else. If you struggle with this method, I can send you a example code (that I used in another project) with a working vfg schema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants