infinite-networks/InfiniteFormBundle

Document use of the collection javascript for normal collections as well as polycollections

merk opened this issue ยท 9 comments

merk commented
Document use of the collection javascript for normal collections as well as polycollections

@merk this is working already but needs documentation? Or still a WIP the rendering?

Cheers,

merk commented

The javascript helper works great but is primarily suited towards using polycollections. It means it will still work exceptionally well for a normal collection. The only real difference between the two is multiple 'prototype' DOM nodes.

https://github.com/infinite-networks/InfiniteFormBundle/blob/master/Resources/doc/collection-helper.md

If you're talking about the polycollection - the dilemma is that there is more than one way to render a form type for a polycollection but none of them are general enough to provide templates by default.

@merk yes, I was talking about rendering for polycollection. I will take a look to that document, and see if I can make it work as, indeed, I need several prototypes and for rendering the forms and that's why bascially, I'm using this bundle. ๐Ÿ˜„

merk commented

Ah, this issue is not about polycollection rendering but the helper documentation. The link wont give you much insight. Right now the best place to see an example of how to render the polycollection is here:

#11 has an example from one of our applications.

ah! Thanks a lot for that link! Surely it would be of much help! ๐Ÿ˜„

@merk not sure if I understand the example very well.

I've managed to create a button with the different type of prototypes, but not being able to render them. Does the following lines of JS do the work or some extra markup is needed?

$(function () {
        $('[data-form-widget=collection]').each(function () {
            new window.infinite.Collection(this, $(this).siblings('[data-prototype]'));
        });
    });

Thanks a lot!

merk commented

Can you create a new issue with your templates and form types please?

@merk I've managed to get it working. Thanks for your help! If I found some time this week, I will raise a PR so that we can work a little bit on documentation of this, as I think is the most valuable feature of the bundle. ๐Ÿ˜„

merk commented

Thanks, I'd appreciate any contribution you can add to the documentation