In many cases, your application might have a child table, like this:
Let’s say we want to hide the Company and Open columns from that child table. You can add a CSS rule to hide specific columns from the child table. In the generated hooks/footer-extras.php
, add code similar to this:
1 2 3 4 5 |
<style> #panel_child-table-lookup-field .child-table-field-to-hide { display: none; } </sttyle> |
In the above code, replace:
child-table
with the name of the child table, “quotes” in the above example.lookup-field
with the name of the lookup field in the child table that points to the parent table, “company” in the above example.field-to-hide
name of the child table field to hide, “company” in the above example
You can repeat the above rule for every column you want to hide. So, to hide the company and open fields:
1 2 3 4 5 6 |
#panel_quotes-company .quotes-company { display: none; } #panel_quotes-company .quotes-open { display: none; } |
The result looks as follows:
Hello,
How can I use this CSS rule if there are several tables with child tables in the application and you want to always hide the same column (the same lookup field)?
Regards Stefan
You would repeat the CSS rule for each table, either by duplicating the code lines above and changing the table and field names, or by combining the CSS selectors into one rule set (separated using commas).
That works, thank you. However, if there are several parent tables with children’s tables that all use the same lookup field, the above mentioned CSS rule in footer-extras.php only the first parent-table. So that works with the other parent tables with child tables I have written the CSS rules in the table name_dv function in the table name.php in the hooks folder. Here I had to omit the area “# panel_child-table-lookup-field”.
> Here I had to omit the area “# panel_child-table-lookup-field”.
You’re right indeed. The rule would then look like this:
.tablename-fieldname { display: none; }