Hiding column for group

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
imike
Posts: 8
Joined: 2020-02-25 15:35

Hiding column for group

Post by imike » 2020-02-27 07:13

Hello,
I am new to the forum and would like to say hello to all of you.

Some time ago I found AppGini in google and we started using it at the company where I work. I think AppGini is great.

I would like to hide columns in the table for a specific group using jquery. I'm trying to do it the following way. The script works in console, but when I add it to hooks it doesn't hide the column. What am I doing wrong?

Code: Select all

function table_name_footer($contentType, $memberInfo, &$args) {
		$footer='';

		switch($contentType) {
			case 'tableview':
				$footer='';
				break;

			case 'detailview':
				$footer='';
				break;

			case 'tableview+detailview':
				$footer='';
				break;

			case 'print-tableview':
				$footer='';
				break;

			case 'print-detailview':
				$footer='';
				break;

			case 'filters':
				$footer='';
				break;
		}
		
		$memberInfo = getMemberInfo();
		echo $memberInfo['group'];
		if($memberInfo['group'] == 'WORKER'){
			echo "<script type='text/javascript'>";
			echo "$j(function() {";
			echo	"$j('th:nth-child(1), td:nth-child(1)').hide();";
			echo "});";
			echo "</script>";
		
		}

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

Re: Hiding column for group

Post by pbottcher » 2020-02-27 18:00

Hi,

dont use echo in the file.

Add the Script to the $footer variable

Also
$memberInfo = getMemberInfo();
echo $memberInfo['group'];
is not needed.

And you should use the appropriate are of your tableview (either tableview or tableview+detailview) as otherwise the code will also be applied to you displayview and that might give strange results.
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.

Post Reply