Jump to content

AtkDataGrid: Difference between revisions

From NusaATK
Change the default limits in the dropdown
Line 18: Line 18:
       // Change the default limit on a node (Show less or more items on a single page)
       // Change the default limit on a node (Show less or more items on a single page)
       $grid->setDefaultLimit(123);
       $grid->setDefaultLimit(123);
 
       // Change the default limits in the dropdown
       // Change the default limits in the dropdown
       $grid->setComponentOption('limit', 'limits', array(10, 20, 30, 40, 50));
       $grid->setComponentOption('limit', 'limits', array(10, 20, 30, 40, 50));
     }
     }
</code>
</code>

Revision as of 09:41, 1 April 2010

Modify datagrid

To modify the behaviour or layout of the datagrid you can add the method 'modifyDatagrid' to your AtkNode.

   /**
    * Modify grid.
    * 
    * @param atkDataGrid $grid grid
    * @param int         $mode CREATE or RESUME
    */
   public function modifyDataGrid(atkDataGrid $grid, $mode)
   {    
     // Remove the record count summary in the bottom right of the datagrid
     $grid->removeComponent("summary");
     
     // Change the default limit on a node (Show less or more items on a single page)
     $grid->setDefaultLimit(123);

     // Change the default limits in the dropdown
     $grid->setComponentOption('limit', 'limits', array(10, 20, 30, 40, 50));
   }