Hi All
I have (finally) gotten back to this issue.
I had a look at the generated code. In views.projecttargets.tmpl.default_filters.php, the code for the filters is as follows:
<div style="float:left">
<!-- SELECT : Project > Code -->
<div class='filter filter_project'>
<label class='filter' for="filter_project"><?php echo(JText::_("VARIABLEPROJECTSDATABASE_JSEARCH_PROJECT")); ?> :</label>
<?php echo JDom::_('html.form.input.select', array(
'dataKey' => 'filter_project',
'dataValue' => (string)$this->filters['project']->value,
'list' => $this->filters['project']->list,
'labelKey' => 'code',
'nullLabel' => "VARIABLEPROJECTSDATABASE_FILTER_NULL_PROJECT",
'submitEventName' => 'onchange'
));
?>
</div>
</div>
<div style="float:left">
<!-- SELECT : Constellation > Code -->
<div class='filter filter_target_constellation'>
<label class='filter' for="filter_target_constellation"><?php echo(JText::_("VARIABLEPROJECTSDATABASE_JSEARCH_CONSTELLATION")); ?> :</label>
<?php echo JDom::_('html.form.input.select', array(
'dataKey' => 'filter_target_constellation',
'dataValue' => (string)$this->filters['target_constellation']->value,
'list' => $this->filters['target_constellation']->list,
'labelKey' => 'code',
'nullLabel' => "VARIABLEPROJECTSDATABASE_FILTER_NULL_CONSTELLATION",
'submitEventName' => 'onchange'
));
?>
</div>
</div>
When looking at the model code for the ProjectTargets (models.forms.projecttargets.php) I can see the following for the setting of the two filters:
//WHERE - FILTER : Project
if($this->getState('filter.project') != null)
$this->addWhere('a.project = '. (int)$this->getState('filter.project'));
//WHERE - FILTER : Code
if($this->getState('filter._target_constellation'))
$this->addWhere('_target_.constellation = '. $this->_db->Quote($this->getState('filter._target_constellation')));
I am new to PHP and Joomla programming, but the code for the (constellation) Code appears radically different to the code for the Project (code). I would have expected it to perhaps look like this (just based on consistency):
//WHERE - FILTER : Code
if($this->getState('filter._target_constellation'))
$this->addWhere('_target_.constellation = '. (int)$this->getState('filter._target_constellation'));
I have tried this, plus a number of other variations (read "stabs in the dark"!), without success.
If anybody has any good ideas, they would be most welcome!!