Menu item filters #41

Closed
opened 2017-02-12 19:09:03 +00:00 by mwweb · 7 comments
mwweb commented 2017-02-12 19:09:03 +00:00 (Migrated from github.com)

I'm probably competent missing something, but I'm trying to figure out how to add 'filters' on site view menu items. For example, on Sermon Distributor you have a preacher dropdown that popped from the preacher table, and can filter the output.

I'm probably competent missing something, but I'm trying to figure out how to add 'filters' on site view menu items. For example, on Sermon Distributor you have a preacher dropdown that popped from the preacher table, and can filter the output.

The front-end/site is not automated, and to build that kind of filter on the front-end would require that you study the back-end list views implementations and then via custom scripting implement that feature on the front.

I usually make use of Footable for my front-end list tables and since it has powerful search and filtering options ready build into it, and since it saves me the headache of building a whole php filter structure for the front-end.

I find that the ajax experience is more appealing to the site users anyway. Check out this component, build with JCB mainly the list view.

The front-end/site is not automated, and to build that kind of filter on the front-end would require that you study the back-end list views implementations and then via custom scripting implement that feature on the front. I usually make use of [Footable](https://github.com/Llewellynvdm/FooTable) for my front-end list tables and since it has powerful search and filtering options ready build into it, and since it saves me the headache of building a whole php filter structure for the front-end. I find that the ajax experience is more appealing to the site users anyway. Check out this [component](http://www.tonata.org/groups), build with JCB mainly the list view.
mwweb commented 2017-02-12 22:21:47 +00:00 (Migrated from github.com)

It wasn't the actual filters that the public would see. This is the menu items being added to the menu on the admin side that I was wondering on. See below what I'm referring to...

menu-item

It wasn't the actual filters that the public would see. This is the menu items being added to the menu on the admin side that I was wondering on. See below what I'm referring to... ![menu-item](https://cloud.githubusercontent.com/assets/19194012/22866629/92402f96-f12e-11e6-9144-213615ae1917.png)

Okay, now that is done in a very interesting way, please review this tutorial where I explain the setup of the config area.

Once you have reviewed that tutorial then you need to in relation to the preachers dropdown, setup a dynamic get method that checks for the id of that preacher. So in sermon distributor if you open the field we used there you will see the field name is "preacher_request_id" so the only part you should change is the word preacher to that of the view you are targeting so it should be "yourview_request_id"

But in the dynamicGet you will only get the ID so if you look in the sermon distributor dynamicGet "Sermons (Preacher id)" ID=22 you will see the Filter is set to FunctionVar | JRequest::getInt('id') = a.preacher

All these things should line-up for that feature to work. So in turn that dynamicGet ID=22 is linked as the mainGet for the Preacher site view. Now it is a list view because we are loading all the sermons of that preacher, and we are using the preacher ID as a filter.

Hope this helps :)

Okay, now that is done in a very interesting way, please [review this tutorial](https://youtu.be/V2WkTjNFjvo?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=646) where I explain the setup of the config area. Once you have reviewed that tutorial then you need to in relation to the preachers dropdown, setup a dynamic get method that checks for the id of that preacher. So in sermon distributor if you open the field we used there you will see the field name is "preacher_request_id" so the only part you should change is the word preacher to that of the view you are targeting so it should be "yourview_request_id" But in the dynamicGet you will only get the ID so if you look in the sermon distributor dynamicGet "Sermons (Preacher id)" ID=22 you will see the Filter is set to `FunctionVar | JRequest::getInt('id') = a.preacher` All these things should line-up for that feature to work. So in turn that dynamicGet ID=22 is linked as the mainGet for the Preacher site view. Now it is a list view because we are loading all the sermons of that preacher, and we are using the preacher ID as a filter. Hope this helps :)
mwweb commented 2017-02-21 21:12:38 +00:00 (Migrated from github.com)

That did help. So, there's not really a way to be able to have multiple filters on a menu item?

That did help. So, there's not really a way to be able to have multiple filters on a menu item?

With the new custom scripting you can really do anything... but in the JCB I have only tested one, maybe more then one can be done but it has not been tested. JCB can do more then I know since it is build with lots of polymorphism.

I use ajax and url vars to manage various data on one page. But hey give it a try and lets see, if we need to add some more code to the core so that it can... I am always open for improvements.

In the compiler this code is build at line 1055 in the Interpretation file and line 11788 in the same file

Follow the string "_request_id" to see how it is done... we can try to improving it, give me your thoughts.

With the new custom scripting you can really do anything... but in the JCB I have only tested one, maybe more then one can be done but it has not been tested. JCB can do more then I know since it is build with lots of polymorphism. I use ajax and url vars to manage various data on one page. But hey give it a try and lets see, if we need to add some more code to the core so that it can... I am always open for improvements. In the compiler this code is build at [line 1055 in the Interpretation file](https://github.com/vdm-io/Joomla-Component-Builder/blob/master/admin/helpers/compiler/e_Interpretation.php#L1055) and [line 11788 in the same file](https://github.com/vdm-io/Joomla-Component-Builder/blob/master/admin/helpers/compiler/e_Interpretation.php#L11788) Follow the string "_request_id" to see how it is done... we can try to improving it, give me your thoughts.

I just looked over the code, and yes there can only be one ID per menu item, but that is a Joomla limitation, you can have countless fields that is accessible via the params on the page, just looke at how I used it here in SD you will see the $this->params->get('some_field_name'); used all over the page. Those values can also be used in the model....

$app = JFactory::getApplication();
$params = $app->getParams();
var_dump($params);exit;

In the Dynamic get custom code area... and you may have access to more filters 👍

I just looked over the code, and yes there can only be one ID per menu item, but that is a Joomla limitation, you can have countless fields that is accessible via the params on the page, just looke at how I used it [here in SD](https://github.com/SermonDistributor/Joomla-3-Component/blob/master/site/views/preachers/view.html.php#L65) you will see the `$this->params->get('some_field_name');` used all over the page. Those values can also be used in the model.... ``` $app = JFactory::getApplication(); $params = $app->getParams(); var_dump($params);exit; ``` In the Dynamic get custom code area... and you may have access to more filters :+1:
mwweb commented 2017-02-21 22:01:47 +00:00 (Migrated from github.com)

OK. I actually went and looked through the component that was developed by another person, who dropped the project, and I'm working on. I thought she had multiple filters on the menu items. I was mistaken. It's actually in the modules that she has multiple filters.

OK. I actually went and looked through the component that was developed by another person, who dropped the project, and I'm working on. I thought she had multiple filters on the menu items. I was mistaken. It's actually in the modules that she has multiple filters.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#41
No description provided.