hide a row when an unwanted word appears

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

hide a row when an unwanted word appears

Post by patsd102 » 2022-06-20 06:56

HI

I wish to hide a row when an unwanted word appears.
For example, if the word "yellow" is entered in any field, the entire row is hidden,

TIA
23.17

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: hide a row when an unwanted word appears

Post by pbottcher » 2022-06-20 17:45

Hi,

you can use the _init hook and add to the $options-QueryWhere your criteria that shall not be shown as a result.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: hide a row when an unwanted word appears

Post by patsd102 » 2022-06-21 09:28

Thanks for your post
I got it to work with the below code inserted in footer-extras

Just thought I would share
Change the values "table" "field" "word to hide row" to suite your site

Code: Select all

<script>
	$j(function(){
      $j('.table-field').each(function(){
		var field = $j(this).text();
				if(field == 'word to hide row'){
			$j(this).parents('tr').hide();
		}		
			
		
	  })
	})	
</script>
23.17

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: hide a row when an unwanted word appears

Post by jsetzer » 2022-06-21 09:39

Please note, with your approach using Javascript the information at the bottom of the table ("Showing records 1 to 10 of n") will be misleading and perhaps confusing to the users, because there will be (n-x) rows, not (n) rows after hiding x rows according to your filter.

In my personal opinion pböttcher's solution is much more efficient and accurate. Filtering will be done on serverside already and footer information will always be correct.
Kind regards,
<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 readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: hide a row when an unwanted word appears

Post by patsd102 » 2022-06-21 20:37

Thanks to the two of you for your input.
I'm not a coder, so I am currently searching
google for a solution,

Funny enough, googling " $options-QueryWhere" brings up appgini forum pages, :)

Thanks

P
23.17

Post Reply