[tutorial] hide child table view field columns

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 351
Joined: 2018-03-04 09:30
Location: David

[tutorial] hide child table view field columns

Post by D Oliveira » 2022-08-08 01:33

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 ?>


User avatar
lramirez
Veteran Member
Posts: 61
Joined: 2019-11-01 23:23

Re: [tutorial] hide child table view field columns

Post by lramirez » 2024-05-07 19:50

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
Attachments
ocultar de la tabla secundaria.png
ocultar de la tabla secundaria.png (12.65 KiB) Viewed 598 times
Luis Ramirez R.

User avatar
lramirez
Veteran Member
Posts: 61
Joined: 2019-11-01 23:23

Re: [tutorial] hide child table view field columns

Post by lramirez » 2024-05-22 17:13

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
Attachments
bolet.png
bolet.png (7.67 KiB) Viewed 532 times
Luis Ramirez R.

SkayyHH
Veteran Member
Posts: 459
Joined: 2015-04-27 21:18

Re: [tutorial] hide child table view field columns

Post by SkayyHH » 2024-05-23 19:52

Hi. Cool. Can i use this with print outs too?

joshianjvj83
Posts: 6
Joined: 2024-05-12 10:13

Re: [tutorial] hide child table view field columns

Post by joshianjvj83 » 2024-09-24 08:14

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.

Post Reply