Sonata admin bundle order

后端 未结 2 1256
忘了有多久
忘了有多久 2020-12-17 15:21

How to change default entity order in SonataAdminBundle for list action?


answer :) add this to your admin class

protected $datagri         


        
2条回答
  •  离开以前
    2020-12-17 15:50

    It is better not to override constructor. But you can override the Admin::configure() method and set some element of the datagridValues array.

    See in example:

    public function configure()
    {
        parent::configure();
    
        $this->datagridValues['_sort_by']    = 'name';
        $this->datagridValues['_sort_order'] = 'DESC';
    }
    

提交回复
热议问题