I am creating a small backend component using the helloworld example. So far so good.
It is working fine except when I change the ordering using the listbox:
Nothing happens to list.ordering
and list.direction
. However, list.fullordering
is changed okay.
The field in filter_jbburgstand.xml looks like this:
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="ID ASC"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="ID ASC">ID oplopend</option>
<option value="ID DESC">ID aflopend</option>
<option value="IPadres ASC">IPadres oplopend</option>
<option value="IPadres DESC">IPadres aflopend</option>
<option value="Datum ASC">Datum oplopend</option>
<option value="Datum DESC">Datum aflopend</option>
<option value="User ASC">Gebruiker oplopend</option>
<option value="User DESC">Gebruiker aflopend</option>
</field>
The populate function looks like this:
protected function populateState($ordering = null, $direction = null)
{
parent::populateState($ordering, $direction);
}
And the ordering part looks like this:
$orderCol = $this->state->get('list.ordering', '');
$orderDirn = $this->state->get('list.direction', '');
// $fullOrder = $this->state->get('list.fullordering', '');
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
//echo "<br>".$query."<br>";
return $query;
Why does this happen?
Additional information
It looks like onchange="this.form.submit();" is not being executed when I change to a (new) ordering (in the listbox).
I think the adminForm should be reloaded and that is not happening.
input
fields, as well as a form.token? – Grant G Aug 29 '20 at 23:50escape()
on the column name in theorder()
call; I recommend calling$db->qn()
so that the string is appropriately quote-wrapped for all database drivers. – mickmackusa♦ Aug 30 '20 at 0:04$config['filter_fields'] = array(
? – pe7er Sep 1 '20 at 9:16