I have created Custom component from component-creator website now I want to add Search tools to this component, Search component like Article search provides. can anyone guide me from where I can add this functionality.
What I have done is add a custom filter code to view.html.php
as shown below:
$db = JFactory::getDbo();
$query = "SELECT DISTINCT countryname as x FROM sugee_sugee_country where state=1 ORDER BY id ASC";
$db->setQuery($query);
$rows = $db->loadObjectList();
$options = array();
$this->state->get('filter.countryname');
foreach ($rows as $row) {
$options[] = JHtml::_('select.option', "$row->x", JText::_($row->x));
}
JHtmlSidebar::addFilter(
'- Select Country -',
'countryname',
JHtml::_('select.options',$options,'value', 'text', $this->state->get('filter.countryname'), false));
My problem is that it does not work properly it always refresh the page and it does save its state like if i select INDIA then it should save INDIA as default. but it is not working and records are also not showing properly.
I have to create any other files for this or i have add any code or function anywhere else ?
Please guide.