Page 1 of 1

[tutorial] hide child table view field columns

Posted: 2022-08-08 01:33
by D Oliveira
Hey guys, have you ever wanted to hide some columns inside a child table but did not want to mess with the original table view setup?

Just use the following code in your hooks/footer-extras.php :)

Code: Select all


<?php ?>

<script type="text/javascript">
	
var my_table = window.location.href;

var parts = my_table.split('/');
var lastSegment = parts.pop() || parts.pop(); 

// select table

if( 'tablename_name' == lastSegment.substr(0, 14) ){


    var detail_view = document.getElementById("detail-view");

    if(detail_view){


	//-- field 1

	var field1 = 'field1';
	var tablename1 = 'tablename_name';

	var cssStyle = document.createElement('style');
	cssStyle.type = 'text/css';
	var rules = document.createTextNode("."+tablename1+"-"+field1+"{display:none}");
	cssStyle.appendChild(rules);
	document.getElementsByTagName("head")[0].appendChild(cssStyle);

	$j("#detail-view").addClass(tablename1"-"+field1);


	//-- field 2

	var field2 = 'field2';
	var tablename2 = 'tablename_name';

	var cssStyle = document.createElement('style');
	cssStyle.type = 'text/css';
	var rules = document.createTextNode("."+tablename2+"-"+field2+"{display:none}");
	cssStyle.appendChild(rules);
	document.getElementsByTagName("head")[0].appendChild(cssStyle);

	$j("#detail-view").addClass(tablename2"-"+field2);



}



</script>

<?php ?>


Re: [tutorial] hide child table view field columns

Posted: 2024-05-07 19:50
by lramirez
Hello Oliveira..
I'm trying to make this configuration... but I don't know why it doesn't work for me...
Can you guide me?

The subform table is "f_boletas" and I try to hide the "codigo" field

thank you

Re: [tutorial] hide child table view field columns

Posted: 2024-05-22 17:13
by lramirez
Hello... researching I found that I can also hide it with CSS and it looks good, for me

Code: Select all

/* TO HIDE FIELDS OF THE SECONDARY my-table */
   .table-striped.table-hover.table-condensed.table-bordered .my_table-field {
    display: none;
   }
Comparing to the previous one, now it looks like this...
and removed the fields that I did not want the user to see and learned to add colors, with the guide from the jsetzer website

Re: [tutorial] hide child table view field columns

Posted: 2024-05-23 19:52
by SkayyHH
Hi. Cool. Can i use this with print outs too?

Re: [tutorial] hide child table view field columns

Posted: 2024-09-24 08:14
by joshianjvj83
I have found How to hide a field in child table view from APPGINI Blog: https://blog.appgini.com/appgini/how-to ... able-view/

However, idk if this does still work (I tried) and include the guide you gave here. Is there any other alternative or guides for me to follow? plus a help out on the changing of child color would also help, huge thanks to people helping out here.