Hello,
I want to render a filter form without using searchtools. I have started with establishing a simple XML file that I put in a correct location (my_component/forms/) with correct name "filter_myview.xml".
I then get the filter form in my view in HtmlView.php
Now, if I am using searchtools in my layout file default.php then the filter form gets rendered. This nicely works.
What I, however, need is to display the filter form without using searchtools (because of a custom layout). So I removed the line with the searchtools and try to render fileds of the filter form using
.
For some reason, the above produces no html. Any hint how to render a filter form without using searchtools? Do I need to implement getFilterForm() in my model myself? With searchtools this is not necessary.
I want to render a filter form without using searchtools. I have started with establishing a simple XML file that I put in a correct location (my_component/forms/) with correct name "filter_myview.xml".
Code:
<?xml version="1.0" encoding="utf-8"?><form addfieldprefix="Freedu\Component\Fugo\Site\Field"><fields name="filter"><fieldname="search"type="text"label="My search box"/><fieldname="day_of_week"type="list"label="Day fo week"onchange="this.form.submit();"><option value="1">Monday</option>...<option value="7">Sunday</option></field></fields></form>
Code:
public function display($template = null) {...$this->filterForm = $this->get('FilterForm');$this->activeFilters = $this->get('ActiveFilters');...// Call the parent display to display the layout fileparent::display($template);}
Code:
<?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
Code:
<?php echo $this->filterForm->renderField('search'); ?><?php echo $this->filterForm->renderField('day_of_week'); ?>
For some reason, the above produces no html. Any hint how to render a filter form without using searchtools? Do I need to implement getFilterForm() in my model myself? With searchtools this is not necessary.
Statistics: Posted by JanoD — Fri Sep 27, 2024 8:24 am