User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This patch use namespaces to load Joomla! libraries and accept multiple values as array for filtering.
Also add the option to set context value in the xml fields. For example:
<field
name="article"
type="sql"
label="COM_EXAMPLE_FORM_ARTICLE"
sql_select="c.id, c.title"
sql_from="#__content AS c"
sql_order="c.id ASC"
sql_filter="catid"
key_field="id"
value_field="title"
context="com_example.list_view_example"
/>
Into the documentation for custom fields is well explained how to use default filters setting sql_default_{field} and a static value but is not explained how to set dynamic variables using user states for filtering. (see testing)
Using the last field example, we can see that we set sql_filter as catid . For filtering we must to set into our view.html.php file, using the setUserState method a value or an array for multiple values. For example:
$multiple_values = array(3, 5, 7);
Factory::getApplication()->setUserState("com_example.list_view_example.filter.catid", $multiple_values);
This is going to filter into the catid field using the values declared in the variable $multiple_values
We should get the list filtered correctly using the static or dynamic values.
Dynamic filtering must to be added to:
https://docs.joomla.org/Special:MyLanguage/SQL_form_field_type
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-04-29 13:24:49 |
Closed_By | ⇒ | HLeithner | |
Labels |
Added:
?
|
Its a fix, not a new feature. Documentation is missing for actual code....
@fastslack is this related to #23568 and / or #22241
@alikon Yes Nicola! Related with both. Fix context is the key to solve this problem.
@HLeithner can you reopen please?
Status | Closed | ⇒ | New |
Closed_Date | 2019-04-29 13:24:49 | ⇒ | |
Closed_By | HLeithner | ⇒ |
Status | New | ⇒ | Pending |
I cleanup your PR a bit...
Should namespaces be in a separate PR for J4 and focus on multiple filters values only in this PR for J3?
Should I? I can make a separate PR but I think tjhat Joomla! 3.9 use namespaces too
Preferably one PR per issue to keep it simple for testing.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-05-08 07:37:34 |
Closed_By | ⇒ | fastslack |
Dear all,
I really appreciate the efforts you put into fixing the dynamic filtering feature of SQL field. But, there is still no documentation update for this feature in Joomla docs. I read the explanations here to apply and use this feature but view.html.php file does not exist for Joomla menu settings or for a plugin. So how or where can I use this feature? Does it really work?
So please, either update the documentation or please check if this feature works in a plugin or in Joomla menu settings.
I can open a new issue if required.
Kind regards
Looks like a new feature and have to go into j4, please rebase on j4-dev branch and create a new PR.