Page 1 of 1

Show filering

Posted: 2019-04-02 21:08
by kbarrett
Hello All,

Using AppGini 5.75 in and working in MyTable.php in Hooks.

I am trying to limit the ability to filter tables by position. I have added Position as memberInfo['custom'][1]. The problem I have is being able to add multiple positions. I used the code below in the function MyTable_init(&$options, $memberInfo, &$args){

if($memberInfo['custom'][1]== 'Manager'){
$options->AllowFilters=1;
}else{
$options->AllowFilters=0;
}
and tried to include multiple positions as the variables to if($memberInfo['custom'][1]== 'Manager') something like if($memberInfo['custom'][1]== 'Manager' or 'Director') and other variations. Any input is appreciated.

Re: Show filering

Posted: 2019-04-02 21:23
by pbottcher
Hi,

maybe you can use something like

switch($memberInfo['custom'][1]) {
case "Manager": $options->AllowFilters=1; break;
case "Director": SET OTHER OPTION; break;
default: $options->AllowFilters=0; break;
}

Re: Show filering

Posted: 2019-04-02 22:22
by kbarrett
Hi,

Tried the code:

switch($memberInfo['custom'][1]) {
case "Manager": $options->AllowFilters=1; break;
case "Director": SET OTHER OPTION; break;
default: $options->AllowFilters=0; break;
}

but the following error string was returned:

Parse error: syntax error, unexpected 'OPTION' (T_STRING) in C:\xampp\htdocs\project\hooks\MyTable.php Did I miss something?

Re: Show filtering

Posted: 2019-04-03 00:50
by kbarrett
BAH!
Colour me thick! I figured it out! Many thanks again!

Kevin