how to get value for search in joomla module.
Does anyone know how to get the value for the search field? my problem is that after i search for specific data it still shows everything
In my helper.php I have this code. but doesn't work
public function getFilterForm()
{
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
Form::addFormPath(dirname(__FILE__) . '/forms');
$form = Form::getInstance('module.filter', 'filter');
return $form;
}
public function getFieldsvalue($params)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
->from('#__users');
$db->setQuery($query);
$rows = $db->loadObjectList();
return $rows;
}
public function loadFormData()
{
$data = $rows->getFieldsvalue();
return $data;
}
I have a folder forms and inside it has filter.xml
in the tmpl folder. the in the default.php this is my code
<form name="adminForm" id="adminForm">
<?php echo JLayoutHelper::render('joomla.searchtools.default', array ('view' => (object) array ('filterForm' => $form))); ?>
<table class="table table-striped">
<thead class="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $item) {?>
<tr>
<th scope="row"><?php echo $item->id; ?></th>
<td><?php echo $item->name; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</form>