symfony2admingenerator / AvocodeFormExtensionsBundle

(old-legacy) Symfony2 form extensions for Admingenerator project (also working standalone!)
Other
48 stars 31 forks source link

add button form collection javascript behaviour doesn't work anymore #24

Closed alexbaron closed 10 years ago

alexbaron commented 10 years ago

Hello,

first i thought that my code was wrong so i decided to make a new sf2 project to test this error.

so i could send my test project as zip file.

the bug:

when i tried to add a collection form throw generator.yml, the "add button" is not present.

data-prototype= is here but i've no javascript behaviour.

help please, this bug is realy blocking my dev.

i work now with sf 2.3.dev

ioleo commented 10 years ago

@alexbaron please post form options you're useing for this field (the generator.yml or custom form type)

alexbaron commented 10 years ago
generator: admingenerator.generator.doctrine
params:
    model: Acme\DemoBundle\Entity\ObjectA
    namespace_prefix: Acme
    entity_manager: ~
    concurrency_lock: ~
    bundle_name: DemoBundle
    pk_requirement: ~
    fields: ~
    object_actions:
        delete: ~
    batch_actions:
        delete: ~
builders:
    list:
        params:
            title: List for DemoBundle
            display: ~
            actions:
                new: ~
            object_actions:
                edit: ~
                delete: ~
    filters:
        params:
            display: ~
    new:
        params:
            title: New object for DemoBundle
            fields:
              relAB:
                label: objects B
                dbType: string
                formType:         collection
                addFormOptions:
                  type:           \Acme\DemoBundle\Form\Type\ObjectB\NewType
                  allow_add:      true
                  allow_delete:   true
                  by_reference:   false
                  options:
                    label:          Add new item
                    data_class:     Acme\DemoBundle\Entity\ObjectB
            display: 
              - nameA
              - relAB
            actions:
                save: ~
                list: ~
    edit:
        params:
            fields:
              relAB:
                label: objects B
                dbType: string
                formType:         collection
                addFormOptions:
                  type:           \Acme\DemoBundle\Form\Type\ObjectB\NewType
                  allow_add:      true
                  allow_delete:   true
                  by_reference:   false
                  options:
                    label:          Add new item
                    data_class:     Acme\DemoBundle\Entity\ObjectB
            title: "You're editing the object \"%object%\"|{ %object%: ObjectA.nameA }|"
            display: 
              - nameA
              - relAB
            actions:
                save: ~
                list: ~
    show:
        params:
            title: "You're viewing the object \"%object%\"|{ %object%: ObjectA.nameA }|"
            display: ~
            actions:
                list: ~
                new: ~
    actions:
        params:
            object_actions:
                delete: ~
            batch_actions:
                delete: ~

the custom form :

namespace Acme\DemoBundle\Form\Type\ObjectA;

use Admingenerated\AcmeDemoBundle\Form\BaseObjectAType\EditType as BaseEditType;

class EditType extends BaseEditType
{
}
alexbaron commented 10 years ago

There is a ManyToMany relation between objectA and objectB.

ioleo commented 10 years ago

@alexbaron change formType to collection_table or collection_fieldset if you want to take advantage of these form types

alexbaron commented 10 years ago

now i've got the buttons (bootstrap_collection.add, bootstrap_collection.delete), but there is no javascript behaviour. May be a javascript file is missing.

ioleo commented 10 years ago

This information was in admingenerator's upgrade notes -> please always read them if you're haveing trouble after admingenerator upgrade.

I've added it to this bundle's readme. Read these installation instructions to add and enable the required assets.