how to hide or show the column(s) via table
-
- Posts: 20
- Joined: 2017-03-12 09:32
how to hide or show the column(s) via table
the title says all... please help me as I spent two hours figuring how to do that and where or which file to put the "working" codes of show and hide the columns to have the table downsize or back to normal? thanks!
Re: how to hide or show the column(s) via table
Up this topic .. I need solution too
Re: how to hide or show the column(s) via table
Take a look at this solution
https://forums.appgini.com/phpbb/viewto ... tabs#p7067
https://forums.appgini.com/phpbb/viewto ... tabs#p7067
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
-
- Posts: 20
- Joined: 2017-03-12 09:32
Re: how to hide or show the column(s) via table
I need something like http://makitweb.com/how-to-hide-and-sho ... ng-jquery/ or https://jsfiddle.net/highwayoflife/8BahZ/4 for table.
I spent few hours trying to put pieces together and try to execute it but failed many times. My co-worker wants to control and minimize some columns.
Here's image of what I did so far... https://photos.app.goo.gl/XcgkqAFG0WRwCJB53
Please help me with this and my deadline is in TWO HOURS!
MANY MANY MANY THANKS
I spent few hours trying to put pieces together and try to execute it but failed many times. My co-worker wants to control and minimize some columns.
Here's image of what I did so far... https://photos.app.goo.gl/XcgkqAFG0WRwCJB53
Please help me with this and my deadline is in TWO HOURS!
MANY MANY MANY THANKS
Re: how to hide or show the column(s) via table
Here is a starting point: each column has a class named "tablename-fieldname" ... You can use that to select the entire column and hide/show it .. To try this live, go to the 'Customers' table of our online demo at https://bigprof.com/demo/customers_view.php ... Press F12 to open the inspector of your browser, and go to the console window and type this command:
If you press Enter, the above code would hide the 'CompanyName' column. To show it again:
You can place the above code inside some checkbox/button handler inside the hooks/tablename-tv.js file (where tablename is the name of the concerned table -- create that file if it's not there).
Code: Select all
$j('.customers-CompanyName').hide()
Code: Select all
$j('.customers-CompanyName').show()
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
-
- Posts: 20
- Joined: 2017-03-12 09:32
Re: how to hide or show the column(s) via table
Awesome, Thank you! I have tried it and it works with this simple line of code.
One problem is if I enter to update the record or click on one of records while details view was on same page to update the information. The whole table just returns to original position with all fields showing there rather than keep one or few columns remains hide until the user clicks to show or something?
Is there a way to do that or too complicated?
Thanks again!
Dave
One problem is if I enter to update the record or click on one of records while details view was on same page to update the information. The whole table just returns to original position with all fields showing there rather than keep one or few columns remains hide until the user clicks to show or something?
Is there a way to do that or too complicated?
Thanks again!
Dave
Re: how to hide or show the column(s) via table
Hmm .. it can be done but might get a bit complicated
You can store the column hide/show options inside cookies and read it from there on page load using JS code similar to this:
You can store the column hide/show options inside cookies and read it from there on page load using JS code similar to this:
Code: Select all
// set a cookie
Cookies.set('fieldname', 'hide');
// get a cookie and use it to show/hide a column:
var hide = Cookies.get('fieldname');
if(hide == 'hide'){ $j('.tablename-fieldname').hide(); }
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
-
- Posts: 20
- Joined: 2017-03-12 09:32
Re: how to hide or show the column(s) via table
Hi, I finally got around to that and tried this script.... it works but I couldn't figure out how to "refresh" cookies or "delete" a cookie?
I tried to add same script but changed from 'hide' to 'show' but it did nothing.
For now, when I click on a column and turn it off (hide it) then it stored into cookies, and it became permanent. I am able to show it but it returns to hide when click on something or refresh a page.
Do you guys know how to refresh with new cookies or something?
I tried to add same script but changed from 'hide' to 'show' but it did nothing.
For now, when I click on a column and turn it off (hide it) then it stored into cookies, and it became permanent. I am able to show it but it returns to hide when click on something or refresh a page.
Do you guys know how to refresh with new cookies or something?
-
- Posts: 20
- Joined: 2017-03-12 09:32
Re: how to hide or show the column(s) via table
I came up with this but can't get it to working.. what did I do wrong?
HTML: <input type="checkbox" name="checkfieldname" />
JavaScript:
Cookies.set('fieldname', 'hide', 'show');
// get a cookie and use it to show/hide a column:
var hide = Cookies.get('fieldname');
var show = Cookies.get('fieldname');
var $checkfieldnameInput = $('input[name="checkfieldname"]');
$checkfieldnameInput.on('click', function(){
if ( $(this).is(':checked') )
if(hide == 'hide'){ $j('.tablename-fieldname').hide(); }
else
if(show == 'show'){ $j('.tablename-fieldname').show(); }
});
HTML: <input type="checkbox" name="checkfieldname" />
JavaScript:
Cookies.set('fieldname', 'hide', 'show');
// get a cookie and use it to show/hide a column:
var hide = Cookies.get('fieldname');
var show = Cookies.get('fieldname');
var $checkfieldnameInput = $('input[name="checkfieldname"]');
$checkfieldnameInput.on('click', function(){
if ( $(this).is(':checked') )
if(hide == 'hide'){ $j('.tablename-fieldname').hide(); }
else
if(show == 'show'){ $j('.tablename-fieldname').show(); }
});
Re: how to hide or show the column(s) via table
i think you should do it like that:
Code: Select all
// get a cookie and use it to show/hide a column:
var status = Cookies.get('fieldname');
if(status == 'hide'){ $j('.tablename-fieldname').hide(); }
else
if(status == 'show'){ $j('.tablename-fieldname').show(); }
var $checkfieldnameInput = $('input[name="checkfieldname"]');
$checkfieldnameInput.on('click', function(){
if ( $(this).is(':checked') ){
$j('.tablename-fieldname').hide();
//set cookies to hide
Cookies.set('fieldname', 'hide');
}else{
$j('.tablename-fieldname').show();
//set cookies to show
Cookies.set('fieldname', 'show');
}
});
-
- Posts: 20
- Joined: 2017-03-12 09:32
Re: how to hide or show the column(s) via table
Hi,
I tried that one and it was not working at all.
I copied and pasted the code and change the filename and tablename on there... it was saved on tablename-dv.js or at hooks/footer-extras.php with script there then I use datalist.php to put codes in there on top of the table after line 837:
I tried to get it work on either codes:
$this->HTML .= '<div>';
$this->HTML .= '<b>Date</b>: <a href="#" onClick="function test(){$j(\'. tablename-fieldname\').hide(); } test(); return false;">Off</a> : <a href="#" onClick="function test(){$j(\'.tablename-fieldname\').show(); } test(); return false;">On</a> ';
$this->HTML .= '</div>';
or
$this->HTML .= '<div>';
$this->HTML .= '<b>Date</b>: <input type="checkbox" name="checkfieldname" /> ';
$this->HTML .= '</div>';
thanks and greatly appreciated!
I tried that one and it was not working at all.
I copied and pasted the code and change the filename and tablename on there... it was saved on tablename-dv.js or at hooks/footer-extras.php with script there then I use datalist.php to put codes in there on top of the table after line 837:
I tried to get it work on either codes:
$this->HTML .= '<div>';
$this->HTML .= '<b>Date</b>: <a href="#" onClick="function test(){$j(\'. tablename-fieldname\').hide(); } test(); return false;">Off</a> : <a href="#" onClick="function test(){$j(\'.tablename-fieldname\').show(); } test(); return false;">On</a> ';
$this->HTML .= '</div>';
or
$this->HTML .= '<div>';
$this->HTML .= '<b>Date</b>: <input type="checkbox" name="checkfieldname" /> ';
$this->HTML .= '</div>';
thanks and greatly appreciated!
Re: how to hide or show the column(s) via table
We're adding this feature to the upcoming AppGini 5.70 without custom coding .. Stay tuned!
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
-
- Posts: 20
- Joined: 2017-03-12 09:32
Re: how to hide or show the column(s) via table
Great to know.. let me know when it comes out. Very soon, I hope.