Plesk

Implement List

Step 1. Implement actions in the controller.

When implementing a new page with a list on it, you need to specify two
actions in the controller:

public function listAction()
{
    $list = $this->_getNumbersList();
    // List object for pm_View_Helper_RenderList
    $this->view->list = $list;
}
public function listDataAction()
{
    $list = $this->_getNumbersList();
    // Json data from pm_View_List_Simple
    $this->_helper->json($list->fetchData());
}

The first action defines the action itself and will have a view defined
in list.phtml. It loads the list and passes it to the view. The
second action defines the way the list can retrieve the data in JSON
format. This action is used when the user changes the sorting method in
the list, or proceeds to the next page (when there are, for example, 30
rows in the list and only 25 are displayed per page). In this case,
instead of reloading the whole page, only the list is reloaded using
AJAX request to the data action of the list.

Step 2. Implement the List object.

Now, it is time to implement the list itself. In order to to be
correctly rendered in the view, it must be an instance of
pm_View_List_Simple.
We recommend implementing it as private method in the controller:

private function _getNumbersList<span class="…
Exit mobile version