The AppGini Blog
A few tips and tricks to make your coding life a tiny bit better.

How to hide a field in child table view

In many cases, your application might have a child table, like this:

An example child table in an AppGini application. We want to hide some
columns from that
table.

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;
}
</style>

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:

Company and Open fields now hidden after applying the above CSS
rules.


Archived Comments

Stefan Koch

2019-08-11 at 9:42 am

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

Genedy

2019-08-12 at 12:20 pm

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).

Stefan Koch

2019-08-13 at 6:58 am

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”.

Genedy

2019-08-13 at 1:40 pm

Here I had to omit the area “# panel_child-table-lookup-field”.

You’re right indeed. The rule would then look like this:

1
.tablename-fieldname { display: none; }