To add a filter to Joomla component side bar using options
$db = JFactory::getDbo();
$query = 'SELECT mycolumn FROM MyTable';
$db->setQuery($query);
$rows = $db->loadObjectList();
$options = array();
foreach ($rows as $row) {
$options[] = JHtml::_('select.option', "$row->mycolumn", JText::_($row->mycolumn));
}
JHtmlSidebar::addFilter('- Select mycolumn -','mycolumn', JHtml::_('select.options',$options,'value', 'text', $this->state->get('filter.mycolumn'), true));
No comments:
Post a Comment