symfony2admingenerator / AdmingeneratorGeneratorBundle

(old-legacy) Admingenerator for Symfony2, parse generator.yml files to build classes
http://symfony2admingenerator.org/
MIT License
360 stars 125 forks source link

Nested List expand display bug on reload #751

Closed lionelbzv closed 10 years ago

lionelbzv commented 10 years ago

Env = SF2.3 / Propel 1.6 / AdminGeneratorGenerator 1.0.0 / FireFox 30

I'm trying to manage a nested list with scopes in AdminGeneratorGenerator (it seems that the existing code does not manage scopes, so I've inherit some core functions).

I've successfully displayed a nested list with 4 scopes and create a new object with right "scope", "left", "right" and "level" value. If I move this object on the tree, it works nice, everything is updated as expected.

I've moved my new element to be the first child of the first displayed node (id="node-2"). If i reload the page, this node has got the "expand" icon: if I click on it, it expands but the child is displaying at the end of the tree, as if it was a child of the last node.

here is the generated html of the "child of node-2":

<tr id="node-15" class="list_trow child-of-node-2">
   (...)
</tr>

It seems to be only a display problem because all datas are ok, but i put here some configs if it could help to explain this bug.

generator.yml

builders:
    nested_list:
        params:
            title:                              Liste des contenus
            max_per_page:                       50
            # sort:                               ~
            scopes:
                group_1: 
                    "Créer, implanter, développer":
                        default:                            ~
                        filters: 
                            inTree:                         1
                    "Anticiper & innover":
                        filters: 
                            inTree:                         2
                    "Dynamiser & promouvoir":
                        filters: 
                            inTree:                         3
                    "Informer & partager":
                        filters: 
                            inTree:                         4
            display:                            [ title, online ]
            actions:
                new:                            ~
            object_actions:
                edit:                           ~
                delete:                         ~

ListController:

    public function indexAction()
    {
        $form = $this->getFilterForm();

        return $this->render('ArexAdminBundle:ContentGenericList:index.html.twig', $this->getAdditionalRenderParameters() + array(
            'ContentGenerics'             => $this->getQuery()->find(),
            'form'                        => $form->createView(),
            'scopes'                      => $this->getScopes(),
        ));
    }

NewController:

    public function preSave(\Symfony\Component\Form\Form $form, \Arex\Model\ContentGeneric $ContentGeneric)
    {
        // get current scope root node
        $rootScope = ContentGenericQuery::create()->treeRoots()->inTree($ContentGeneric->getContentCategoryId())->findOne();
        if (!$rootScope) {
            throw new \Exception('Root node of scope not found.');
        }

        $ContentGeneric->insertAsLastChildOf($rootScope);
    }
lionelbzv commented 10 years ago

The problem comes from the scopes which are not managed in the JS code > I close this issue