How to change default entity order in SonataAdminBundle for list action?
answer :) add this to your admin class
protected $datagridValues = array( '_page' => 1, '_sort_order' => 'DESC', // sort direction '_sort_by' => 'id' // field name );
How to change default entity order in SonataAdminBundle for list action?
answer :) add this to your admin class
protected $datagridValues = array( '_page' => 1, '_sort_order' => 'DESC', // sort direction '_sort_by' => 'id' // field name );
You can add another sort order or set a default one via the constructor like this:
It is better not to override constructor. But you can override the
Admin::configure()
method and set some element of thedatagridValues
array.See in example: