2 - List default template
The next step is to prepare the template
/ administrator / components / com_dealer / views / cars / tmpl / default.php
The default list template, like the view main file, will be pretty much the same for every list view, as the true main differences are made by the content, not by the view management structure. Probably you will copy and paste this file too, as is, for every list default.php file.
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$this->user = JFactory::getUser();
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'a.ordering';
$options = array();
$options['this'] = $this;
// USE TEMPLATE O LAYOUT ///////////////////////////
// enable template to use template view's templates:
// layouts will be used otherwise searching for them in
$options['template'] = true;
// USE FILTER FORM ////////////////////////////////
// enable filter to include filter form
// IT REQUIRES ITS FILTER FORM TO BE IN MODELS/FORMS FOLDER
$options['filter'] = true;
// ORDERING TABLE ROWS
// we have to identify each group in order to get a different order for each of them
// to do it, we set the group ID in the table tag
$options['ordering'] = array();
$options['ordering']['orderingGroupId'] = Bp::getView().'List';
// ordering instructions
$options['listOrder'] = $this->listOrder;
$options['listDirn'] = $this->listDirn;
$this->options = $options;
echo BpForm::adminList($this->sidebar, $this->items, $this->pagination, $options);
The dirty work is still made by the class BpForm, through the method adminList().
Applying the same philosophy we used for the toolbar buttons, we pass an array of instructions to the method to customize the list form. The script is pretty self-explanatory so we are not going to explain the same process twice.
For the sake of clarity we added tons of extra comments but obviously you can get rid of them in your files, even if we suggest to keep them handy.
All you have to do is to prepare your head, body and foot files, your true core component.
Congratulation! You just stopped to waste your time over what the CMS can do for you!