Page 1 of 1
Hide Row based on value
Posted: 2022-01-29 15:19
by jfehr
Hi i have a code i use the Highlights rows based on what selected.
i like to Hide a row for example if(status == 'Invoiced') like to hide that row.
can anyone Help?
Thanks.
<script>
$j(function(){
$j('.Tickets-Status').each(function(){
var status = $j(this).text();
if(status == 'New'){
$j(this).parents('tr').addClass('info');
}
if(status == 'Complete'){
$j(this).parents('tr').addClass('success');
}
if(status == 'Invoiced'){
$j(this).parents('tr').addClass('warning');
}
if(status == 'On Hold'){
$j(this).parents('tr').addClass('danger');
}
if(status == 'Close'){
$j(this).parents('tr').addClass('danger');
}
})
})
</script>
Re: Hide Row based on value
Posted: 2022-01-29 17:12
by jsetzer
Instead of using javascript for hiding the already loaded table rows, what about filtering records already on serverside using AppGini's built in filtering options?
Doing it that way the pagination/paging would still work as expected and not showing misleading values ("Showing records 1-10 of 60" First/Prev/Next/Last buttons, Page 1 / 2 / ...)
Just an idea.
Re: Hide Row based on value
Posted: 2022-01-29 17:19
by jsetzer
Code: Select all
// ...
if(status == 'Invoiced')
$j(this).closest('tr').fadeOut();
// or $j(this).closest('tr').hide();
// or $j(this).closest('tr').addClass('hidden');
// ...
Re: Hide Row based on value
Posted: 2022-02-01 01:37
by jfehr
jsetzer Thank you so much for you reply.
1st option seems like a much better idea.
only Problem is i m not familiar with these filtering options.
any help would be much appreciated.
Re: Hide Row based on value
Posted: 2022-02-01 05:03
by jsetzer
jfehr wrote: ↑2022-02-01 01:37
i m not familiar with these filtering options.
any help would be much appreciated.
Re: Hide Row based on value
Posted: 2022-02-01 05:09
by jfehr
Is there a way to run this link
<a href="
http://localhost/jfs/Tickets_view.php?S ... >Filter</a>
when opening this one?
<a href="Tickets_view.php"></i>Tickets</a>
Re: Hide Row based on value
Posted: 2022-02-01 06:00
by jsetzer

- chrome_8bk9ZffLh2.png (10.84 KiB) Viewed 2798 times
Hi, when posting code (for example HTML, PHP, CSS or Javascript-code, here: your links) can you please use
[code]
...
[/code]
. This will help us reading your post and helping you. Thank you.
See here:
app.php/help/bbcode#f2r1
Re: Hide Row based on value
Posted: 2022-02-01 06:11
by jsetzer
jfehr wrote: ↑2022-02-01 05:09
Is there a way to run this link
<a href="http://localhost/jfs/Tickets_view.php?SortField=&SortDirection=&FilterAnd%5B1%5D=and&FilterField%5B1%5D=13&FilterOperator%5B1%5D=not-equal-to&FilterValue%5B1%5D=Invoiced">Filter</a>
when opening this one?
<a href="Tickets_view.php"></i>Tickets</a>
Well, there are many places where you would have to replace the original link by the custom link. If I was you, I would not do so.
Alternatives:
- You can add the link for the filtered view into menu
see hooks/links-navmenu.php
- You can add the link for the filtered view to your homepage
see hooks/links-home.php
- You can add filters in TABLENAME_init() function as described here:
https://bigprof.com/appgini/tips-and-tu ... ult-filter
- If you don't want users of a certain group to see those invalid records, you can consider changing ownership of those records to a user of a different group (for example to "admin") using
set_record_owner
function, then limit read-permissions for the group to "Group only". As admin you will still see those records, but the users will not. Just as an idea.