I need to hide a column for non Admins groups in TV, right now, I could managed to do it by inserting this code in the mytable.php hook>
if ($memberInfo['group'] != 'Admins')
{
$options->Template = 'hooks/mdcaja_templateTV_na.html';//whic has only 6 columns instead of 7
$options->ColCaption = array("Comprobante", "No. de casa", "Fecha", "Tipo", "Concepto", "Valor");//With this I hide the column name
}
However, because the original table has 7 colunms, and I am also using column sum for one of the fields, the column sum spans longer and covers more space that the other columns in the table.
Checking the source, I can see a <td colspan=7> code, Does anybody know how can I dinamycally change to <td colspan=6> in order to correctly format my table View.
Wilfredo
Hide field in table view
Re: Hide field in table view
Hi,
can you post the source you are refering to pls and a screenshot.
can you post the source you are refering to pls and a screenshot.
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.
Re: Hide field in table view
Thank you Pbottcher,
These are the screenshots
These are the screenshots
- Attachments
-
- escondercol.png (84.46 KiB) Viewed 6646 times
-
- hidecolumns.jpg (92.85 KiB) Viewed 6646 times
Re: Hide field in table view
Hi,
I don't think changing the col-span would solve your problem. I think the sum at the end still knows about you "hidden column" and hence it is still displayed.
In order to change this you can add the following to the mytable_header function:
I don't think changing the col-span would solve your problem. I think the sum at the end still knows about you "hidden column" and hence it is still displayed.
In order to change this you can add the following to the mytable_header function:
Code: Select all
function mytable_header($contentType, $memberInfo, &$args){
$header='';
switch($contentType){
case 'tableview':
if ($memberInfo['group'] != 'Admins')
{
$header='<%%HEADER%%><script>
$j(function () {
$j(\'.<YOUR_HIDDEN_COLUMN_NAME\').hide();
});
</script>';
}
break;
case .....
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.
Re: Hide field in table view
Hi again and thank you for your answer.
I have tried your code but this will just hide the values of the seventh column. I had remove this code from mytable.php hook:
$options->ColCaption = array("Comprobante", "No. de casa", "Fecha", "Tipo", "Concepto", "Valor");//With this I hide the column name
And then I applied your code and the result is that it only hides the values of the 7th code. I attach a screenshot below.
You are right that the sum at the end is spaning to the 7th column, but the column that knows that there are still seven columns is the one that counts the records. So to solve the problem I think we need to dinamycally replace the colspan to 6 on that line of code.
Thanks again for your help.
Wilfredo
I have tried your code but this will just hide the values of the seventh column. I had remove this code from mytable.php hook:
$options->ColCaption = array("Comprobante", "No. de casa", "Fecha", "Tipo", "Concepto", "Valor");//With this I hide the column name
And then I applied your code and the result is that it only hides the values of the 7th code. I attach a screenshot below.
You are right that the sum at the end is spaning to the 7th column, but the column that knows that there are still seven columns is the one that counts the records. So to solve the problem I think we need to dinamycally replace the colspan to 6 on that line of code.
Thanks again for your help.
Wilfredo
- Attachments
-
- hidecolumns2.png (46.29 KiB) Viewed 6623 times
Re: Hide field in table view
Hi,
you should not remove your code, just add mine and that should work together.
you should not remove your code, just add mine and that should work together.
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.
Re: Hide field in table view
Sorry Pbotcher,
You were actually right, I have tried the code locally and modified the colspan to 6 and the issue is not actually there, you are totally right is should be in the sum row.
Wilfredo
You were actually right, I have tried the code locally and modified the colspan to 6 and the issue is not actually there, you are totally right is should be in the sum row.
Wilfredo
Re: Hide field in table view
I found it, it was there in the sum:
<tr class="success"><td class="text-center"><strong>∑</strong></td><td class="mdcaja-compro_mdcaja"></td><td class="mdcaja-numcasa_mdcaja"></td><td class="mdcaja-fecha_mdcaja"></td><td class="mdcaja-tipo_mdcaja"></td><td class="mdcaja-concep_mdcaja"></td><td class="mdcaja-valor_mdcaja text-right">$58.00</td><td class="mdcaja-vecino_mdcaja"></td></tr>
The last column is still there, the one that is hidden.
Now It is only a matter to find a way to remove it from the generate table_view.php
<tr class="success"><td class="text-center"><strong>∑</strong></td><td class="mdcaja-compro_mdcaja"></td><td class="mdcaja-numcasa_mdcaja"></td><td class="mdcaja-fecha_mdcaja"></td><td class="mdcaja-tipo_mdcaja"></td><td class="mdcaja-concep_mdcaja"></td><td class="mdcaja-valor_mdcaja text-right">$58.00</td><td class="mdcaja-vecino_mdcaja"></td></tr>
The last column is still there, the one that is hidden.
Now It is only a matter to find a way to remove it from the generate table_view.php
Re: Hide field in table view
I did try my code together with yours and nothing happened so I remove mine in order try only yours
Re: Hide field in table view
I am Back again, I finally make it work, your code was right, it was the "<" sign I did not notice it was there.
Sorry for all the misunderstanding.
Wilfredo
Sorry for all the misunderstanding.
Wilfredo
Re: Hide field in table view
Hello
Trying to do the same but unfortunatelly my coding level is not strong enought to understand. can you please share full code et details.
Thank you
Trying to do the same but unfortunatelly my coding level is not strong enought to understand. can you please share full code et details.
Thank you