I have this function which was created by j-cook in my view.html.php file. I want the items in the generated list to be sorted by "title". How do I do this? Thanks!
protected function displayAjax($tpl = null)
{
$jinput = new JInput;
$render = $jinput->get('render', null, 'CMD');
$token = $jinput->get('token', null, 'BASE64');
$values = $jinput->get('values', null, 'ARRAY');
switch($render)
{
case 'filter1':
$model = $this->getModel();
$items = $model->getItems();
/* Ajax Filter : client > STUDY
* Called from: view:progressreports, layout:default
* Group Level : 0
*/
$selected = (is_array($values))?$values[count($values)-1]:null;
$event = 'jQuery("#filter_study").val(this.value);submitform();';
echo "<div class='ajaxchain-filter ajaxchain-filter-hz'>";
echo "<div class='separator'>";
echo JDom::_('html.form.input.select', array(
'dataKey' => '__ajx_study',
'dataValue' => $selected,
'formControl' => null,
'list' => $items,
'listKey' => 'id',
'labelKey' => 'title',
'nullLabel' => "CFMC_JSEARCH_SELECT_STUDY",
'selectors' => array(
'onchange' => $event
)
));
echo "</div>";
echo "</div>";
break;
case 'groupby1':
$model = $this->getModel();
$items = $model->getItems();
/* Ajax Chain : client > STUDY
* Called from: view:progressreport, layout:editprogressreport
* Group Level : 0
*/
$selected = (is_array($values))?$values[count($values)-1]:null;
$event = 'jQuery("#jform_study").val(this.value);';
echo "<div class='ajaxchain-filter ajaxchain-filter-hz'>";
echo "<div class='separator'>";
echo JDom::_('html.form.input.select', array(
'dataKey' => '__ajx_study',
'dataValue' => $selected,
'formControl' => 'jform',
'list' => $items,
'listKey' => 'id',
'labelKey' => 'title',
'nullLabel' => "CFMC_JSEARCH_SELECT_STUDY",
'selectors' => array(
'onchange' => $event
)
));
echo "</div>";
echo "</div>";
break;
}
jexit();
}