Page 1 of 1

Hiding column for group

Posted: 2020-02-27 07:13
by imike
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>";
		
		}

Re: Hiding column for group

Posted: 2020-02-27 18:00
by pbottcher
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.