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

New Example: Create table with inputs in cells #67

Open
aguirrel opened this issue Aug 7, 2015 · 15 comments
Open

New Example: Create table with inputs in cells #67

aguirrel opened this issue Aug 7, 2015 · 15 comments

Comments

@aguirrel
Copy link

aguirrel commented Aug 7, 2015

I would like an example that demonstrates: how to create a table with inputs in cells like
lineitem

Is it possible?

Thanks a lot!

@kentcdodds
Copy link
Member

This is definitely possible, but I don't think that I have the time to create an example like this for you. You could give it a shot and follow the instructions here: http://help.angular-formly.com

@aguirrel
Copy link
Author

aguirrel commented Aug 7, 2015

Hi @kentcdodds, thanks! Could you give me some little help how to structure it? Should I use Wrappers? Only templates? Anything you say will be helpful :)

@kentcdodds
Copy link
Member

So, you'll either want to have a formly-form for each row or use a field group. I would make each item in the row a field. It sort of depends on your use case, but they probably don't need wrappers. Only use wrappers if you find yourself repeating the same html in multiple templates. You might also consider creating a template manipulator.

@aguirrel
Copy link
Author

aguirrel commented Aug 7, 2015

Thanks a lot! I will come back with an example.

@aguirrel
Copy link
Author

Hi @kentcdodds I did and example at http://plnkr.co/edit/LtDqUdT47kQgKsqMQHgq?p=preview

Main problem is that fields code and description are on the same tag, I can't manage to do td tag individual for each subfield. Could you have a minute to give me some advice?

Thanks a lot!

Best regards.

@kentcdodds
Copy link
Member

@aguirrel
Copy link
Author

Hi @kentcdodds! Thanks a lot for your time! Is much near what I need, but, I'm wondering, why 'TR's tags are outside TABLE tag?

@kentcdodds
Copy link
Member

Yeah, that's weird... I'm not sure why that's happening... Sorry, I don't have time to diagnose it right now :-/

@aguirrel
Copy link
Author

NP, anyway you gave me some clue about the solution. Thanks! and great job!

@aguirrel
Copy link
Author

Hi @kentcdodds, I found a solution for this behaviour, but I'm a step behind my objetive.

http://plnkr.co/edit/XhBBkBybT3SLHkvFp8NZ?p=preview

Now problem is I can't create tbody. I sould have thead and tbody, if you check example and changes in HTML:

<formly-form model="vm.model" root-el="div" field-root-el="table" fields="vm.fields" options="vm.options" form="vm.form">

to

<formly-form model="vm.model" root-el="table" field-root-el="tbody" fields="vm.fields" options="vm.options" form="vm.form">

I just get an error: Error: [$compile:tplrt] Template for directive 'formlyForm' must have exactly one root element.

Thanks a lot!

@kentcdodds
Copy link
Member

I'm not seeing the issue you're describing, for me it just doesn't output
at all...

P.S. I hate tables :-( Is there any way you could use bootstrap columns or
flexbox?

-Kent C. Dodds

On Tue, Aug 11, 2015 at 8:28 AM, Luis Aguirre [email protected]
wrote:

Hi @kentcdodds https://github.com/kentcdodds, I found a solution for
this behaviour, but I'm a step behind my objetive.

http://plnkr.co/edit/XhBBkBybT3SLHkvFp8NZ?p=preview

Now problem is I can't create tbody. I sould have thead and tbody, if you
check example and changes in HTML:

to

I just get an error: Error: [$compile:tplrt] Template for directive
'formlyForm' must have exactly one root element.

Thanks a lot!


Reply to this email directly or view it on GitHub
#67 (comment)
.

@aguirrel
Copy link
Author

I will try with flexbox. I like table becouse is more standard ;) Thanks a lot!!!

@mikehaas763
Copy link

@aguirrel Did you ever come to a solution for this?

@aguirrel
Copy link
Author

@mikehaas763, no, I couldn't create tbody and thead for table. This directive is awesome, but DOM is polluted so much. I ended up using https://github.com/json-schema-form/angular-schema-form which is great and easier to extend, I did this table template and 2 more in some hours.

@EsaudTapia
Copy link

Did you manage to make the table?

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

4 participants