Changes between Version 14 and Version 15 of AjaxList


Ignore:
Timestamp:
2010-09-02T18:06:22Z (14 years ago)
Author:
Serge Okon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AjaxList

    v14 v15  
    3636}}}
    3737Next, add your model to the $uses array, in the same fashion as the components above:
    38 var $uses = array('EvaluationRubric',
     38var $uses = array('ListedModel');
    3939
    40 Next, create the following functions in the controller:
     40Next, create the following 3 functions in the controller:
    4141{{{
    42 // Sets up the data for the ajax list
     42// 1) Sets up the data for the ajax list.
    4343function setUpAjaxList () {
    4444
    45    // Which columns to list, and include data from.
    46    $columns = array();
    47    // The available actions for each column
    48    $actions = array();
    49    // Any extra filtering to perform on the data from the database.
    50    $extraFilters = "";
    51    // Any tables to join in, and any extra filters to implement on those tables
    52    $joinTables = "";
    53    // Whether to fetch associated data or not ( (-1) means not at all ).
    54    $recursive = (-1);
     45    // Which columns to list, and include data from.
     46    $columns = array();
     47    // The available actions for each column
     48    $actions = array();
     49    // Any extra filtering to perform on the data from the database.
     50    $extraFilters = "";
     51    // Any tables to join in, and any extra filters to implement on those tables
     52    $joinTables = "";
     53    // Whether to fetch associated data or not ( (-1) means not at all ).
     54    $recursive = (-1);
    5555
    56   $this->AjaxList->setUp($this->, $columns, $actions,
    57             "Group.group_num", "Group.group_name",
    58             $joinTables, $extraFilters, $recursive, "postProcess");
     56    // Call the Ajax List components to fetch data and other list variables,
     57    //  and set them up for the view.
     58    $this->AjaxList->setUp($this->ListedModel,
     59       $columns, $actions,
     60       "ListedModel.id",  // Initial Sorting Column
     61       "ListedModel.id",  // Initial Search-by column
     62       $joinTables, $extraFilters, $recursive);
    5963}
     64}}}
     65{{{
     66    // Processes an Ajax request from the client.
     67    function ajaxList() {
     68        // Set up the list
     69        $this->setUpAjaxList();
     70        // Process the request for data
     71        $this->AjaxList->asyncGet();
     72    }
     73}}}
     74{{{
     75    // Creates the initial list to display by the client
     76    function list() {
     77        // Set up the basic static ajax list variables
     78        $this->setUpAjaxList();
     79
     80        // Set the display list for render by the view
     81        $this->set('paramsForList', $this->AjaxList->getParamsForList());
     82    }
    6083}}}
    6184