Hello.
I would like to create several tabs in home page which incorporate a basic filter. E.g. New York as its city.
After open the table the table much keep the 'basic' filter (City='New York') and when the user searches for anything eg. telephone the filter must be WHERE City = 'New York' AND Telephone LIKE '%555-3333%'
How can apply that feature?
In hooks directory?
Best regards
Open table with filter
Re: Open table with filter
Perhaps you can create a view in MySQL showing a subset of records from Companies, and apply the filter in your view.
-
- Posts: 29
- Joined: 2020-12-26 10:17
Re: Open table with filter
I'm pretty sure even without custom database views you can just add links and/or menu items pointing to filtered table views.
Remember that table views accept url parameters like
Just try it in your browser address bar with your specific TABLENAME and any lookup column. Should work out of the box.
Having unserstood that feature, it's just about adding links. See docs about
Remember that table views accept url parameters like
TABLENAME_view.php?filterer_xyz_id=123
.Just try it in your browser address bar with your specific TABLENAME and any lookup column. Should work out of the box.
Having unserstood that feature, it's just about adding links. See docs about
links-navmenu.php
and links-home.php
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.14 Revision 1665 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.14 Revision 1665 + all AppGini Helper tools
Re: Open table with filter
Example Code
Dashboard
( including my quick and dirty typo in description and tooltip)
Table view
Default table view, filtered by
---
Hints and Tips
Code: Select all
<!-- file: hooks/links-home.php -->
<?php
// in this case, 'tasks' is the table name
// node_id is a lookup column
$homeLinks[] = [
'url' => 'tasks_view.php?filterer_node_id=10',
'title' => 'Filter by node_id (10)',
'description' => 'This is my custom descriptsion',
'groups' => ['*'],
'icon' => getTableList(true)['tasks'][2],
];
( including my quick and dirty typo in description and tooltip)
Table view
Default table view, filtered by
node_id
= 10---
Hints and Tips
- Note that parameter names start with
filterer_
(notfilter_
) - This will work with lookups by default.
- For other filters/restrictions, feel free to pass any parameter(s) and modify
$options->QueryWhere
inTABLENAME_init()
hook accordingly. - Also, you can make use of
$_SESSION
variable for keeping certain filters active while logged in, unless changed. - As
links-home.php
is a standard PHP file, you can add as many different links as you need to the$homeLinks
array, for example fetch all distinct values from a table, then create a link per value. Just be careful with too many records.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.14 Revision 1665 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.14 Revision 1665 + all AppGini Helper tools
-
- Posts: 29
- Joined: 2020-12-26 10:17
Re: Open table with filter
@jsetzer
Thanks a lot!
Thanks a lot!
Re: Open table with filter
Yes.dathanasios wrote: ↑2024-10-01 11:51Thank you for your response.
Let's say I will create views with the filter. Is there any way to add them in the menu from AppGini designer?
Regards
In AppGini, copy table `companies` to new table `companies_newyork`. Generate your codes and update database.
In MySQL, create view with another name first, then delete table `companies_newyork`, rename your view to `companies_newyork`. (Or try the shortcut way: delete table `companies_newyork` then only create view with the same name as `companies_newyork`)
This will work as long as the table structure is the same. If it is different, make sure your view structure is the same with your `companies_newyork` table in AppGini.
Re: Open table with filter
Yet another way is using the addFilter() function as described in this page:
https://bigprof.com/appgini/tips-and-tu ... ers/part-1
https://bigprof.com/appgini/tips-and-tu ... ers/part-1
Re: Open table with filter
Absolutely right!
Keep in mind you may have to change indexes after reordering or inserting columns then.
That's the reason I do not recommend addFilter. Just my personal opinion.
Keep in mind you may have to change indexes after reordering or inserting columns then.
That's the reason I do not recommend addFilter. Just my personal opinion.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.14 Revision 1665 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.14 Revision 1665 + all AppGini Helper tools