Bläddra i källkod

Moved documentation for default list view sorting

Jaik Dean 11 år sedan
förälder
incheckning
d3b6267594
2 ändrade filer med 36 tillägg och 38 borttagningar
  1. 36 3
      Resources/doc/reference/action_list.rst
  2. 0 35
      Resources/doc/reference/advance.rst

+ 36 - 3
Resources/doc/reference/action_list.rst

@@ -3,8 +3,8 @@ The List View
 
 
 .. note::
 .. note::
 
 
-    This document is a stub representing a new work in progress. If you're reading 
-    this you can help contribute, **no matter what your experience level with Sonata 
+    This document is a stub representing a new work in progress. If you're reading
+    this you can help contribute, **no matter what your experience level with Sonata
     is**. Check out the `issues on Github`_ for more information about how to get involved.
     is**. Check out the `issues on Github`_ for more information about how to get involved.
 
 
 This document will cover the List view which you use to browse the objects in your
 This document will cover the List view which you use to browse the objects in your
@@ -36,9 +36,42 @@ To do:
 Customising the sort order
 Customising the sort order
 --------------------------
 --------------------------
 
 
+Configure the default ordering in the list view
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Configuring the default ordering column can simply be achieved by overriding
+the ``datagridValues`` array property. All three keys ``_page``, ``_sort_order`` and
+``_sort_by`` can be omitted.
+
+.. code-block:: php
+
+    <?php
+
+    use Sonata\AdminBundle\Admin\Admin;
+
+    class PageAdmin extends Admin
+    {
+        // ...
+
+        /**
+         * Default Datagrid values
+         *
+         * @var array
+         */
+        protected $datagridValues = array(
+            '_page' => 1,            // display the first page (default = 1)
+            '_sort_order' => 'DESC', // reverse order (default = 'ASC')
+            '_sort_by' => 'updated'  // name of the ordered field
+                                     // (default = the model's id field, if any)
+
+            // the '_sort_by' key can be of the form 'mySubModel.mySubSubModel.myField'.
+        );
+
+        // ...
+    }
+
 To do:
 To do:
 
 
-- how to set the default sort order
 - how to sort by multiple fields (this might be a separate recipe?)
 - how to sort by multiple fields (this might be a separate recipe?)
 
 
 
 

+ 0 - 35
Resources/doc/reference/advance.rst

@@ -127,41 +127,6 @@ To create your own RouteBuilder create the PHP class and register it as a servic
     </service>
     </service>
 
 
 
 
-Configure the default page and ordering in the list view
---------------------------------------------------------
-
-Configuring the default page and ordering column can simply be achieved by overriding
-the ``datagridValues`` array property. All three keys ``_page``, ``_sort_order`` and
-``_sort_by`` can be omitted.
-
-.. code-block:: php
-
-    <?php
-
-    use Sonata\AdminBundle\Admin\Admin;
-
-    class PageAdmin extends Admin
-    {
-        // ...
-
-        /**
-         * Default Datagrid values
-         *
-         * @var array
-         */
-        protected $datagridValues = array(
-            '_page' => 1,            // display the first page (default = 1)
-            '_sort_order' => 'DESC', // reverse order (default = 'ASC')
-            '_sort_by' => 'updated'  // name of the ordered field 
-                                     // (default = the model's id field, if any)
-    
-            // the '_sort_by' key can be of the form 'mySubModel.mySubSubModel.myField'.
-        );
-
-        // ...
-    }
-
-
 Inherited classes
 Inherited classes
 -----------------
 -----------------