diff --git a/etemplate/doc/reference.html b/etemplate/doc/reference.html index 14ac8bd28f..084ba3df85 100644 --- a/etemplate/doc/reference.html +++ b/etemplate/doc/reference.html @@ -786,10 +786,6 @@ function get_rows($query,&$rows,&$readonlys) { $rows = array( ); } - else - { - array_unshift($rows,0); each($rows); // first entry is not used !!! - } $readonlys = array( ); // set readonlys to enable/disable our edit/delete-buttons while (list($n,$note) = each($rows)) { @@ -846,9 +842,9 @@ function index($content = 0)
Nextmatch-
FilterHeader
Nextmatch-
FilterHeader
Nextmatch-
AccountFilter
+ <nextmatch type="nextmatch-sortheader" id="col-name" options="DESC" label="ColLabel"/>
<nextmatch type="nextmatch-filterheader" id="col-name"/>
<nextmatch type="nextmatch-accountfilter" id="col-name"/>
nextmatch-filterheader
Widget to allow to show only certain row, which match a selected filter-value. The column-name is given as name
diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php
index c775816075..502d81298e 100644
--- a/etemplate/inc/class.nextmatch_widget.inc.php
+++ b/etemplate/inc/class.nextmatch_widget.inc.php
@@ -113,7 +113,8 @@
);
switch ($cell['type'])
{
- case 'nextmatch-sortheader':
+ case 'nextmatch-sortheader': // Option: default sort: ASC(default) or DESC
+ $extension_data['default_sort'] = preg_match('/^(ASC|DESC)$/i',$cell['size']) ? strtoupper($cell['size']) : 'ASC';
$cell['type'] = 'button';
$cell['onchange'] = True;
if (!$cell['help'])
@@ -135,7 +136,7 @@
}
return True;
- case 'nextmatch-filterheader':
+ case 'nextmatch-filterheader': // Option: as for selectbox: [extra-label(default ALL)[,#lines(default 1)]]
$cell['type'] = 'select';
if (!$cell['size'])
{
@@ -149,7 +150,7 @@
$extension_data['old_value'] = $value = $nm_global['col_filter'][$this->last_part($name)];
return True;
- case 'nextmatch-accountfilter':
+ case 'nextmatch-accountfilter': // Option: as for selectbox: [extra-label(default ALL)[,#lines(default 1)]]
$cell['type'] = 'select-account';
$cell['name'] .= '[account]';
if (!$cell['size'])
@@ -305,14 +306,15 @@
if ($value_in)
{
$nm_global['order'] = $this->last_part($name);
+ $nm_global['default_sort'] = $extension_data['default_sort'];
}
return False; // dont report value back, as it's in the wrong location (rows)
case 'select-account': // used by nextmatch-accountfilter
case 'nextmatch-filterheader':
- if ($value_in != $extension_data['old_value'])
+ if ($value_in != $extension_data['old_value'] && !(!$value_in && !$extension_data['old_value']))
{
- //echo "
setting nm_global[filter][".$this->last_part($name)."]=$value_in
\n"; + //echo "setting nm_global[filter][".$this->last_part($name)."]='$value_in' (was '$extension_data[old_value]')
\n"; $nm_global['filter'][$this->last_part($name)] = $value_in; } return False; // dont report value back, as it's in the wrong location (rows) @@ -381,7 +383,15 @@ elseif ($nm_global['order']) { $value['order'] = $nm_global['order']; - $value['sort'] = $old_value['order'] == $nm_global['order'] && $old_value['sort']!='DESC'?'DESC':'ASC'; + if ($old_value['order'] != $value['order']) + { + $value['sort'] = $nm_global['default_sort']; + } + else + { + $value['sort'] = $old_value['sort'] != 'DESC' ? 'DESC' : 'ASC'; + } + //echo "old_value=$old_value[order]/$old_value[sort] ==> $value[order]/$value[sort]
\n"; $loop = True; } elseif ($nm_global['filter'])