Hide DataGrid column on the fly

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Hide DataGrid column on the fly

Post by lohill » Tue Mar 27, 2012 10:40 pm

I know I can hide a button under program control with a command like:
set the visible of button "MyButton" to false

I would like to be able to hide a column of a datagrid on the fly. I have tried things like:
'set the visible of column "MyCol" of group "DataGrid 1" to false' - but I get an error message.

It can be done in the Property Inspector so there must be a way under program control.
Any suggestions?

Thanks,
Larry

Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 163
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Re: Hide DataGrid column on the fly

Post by Zryip TheSlug » Tue Mar 27, 2012 10:53 pm

lohill wrote:I know I can hide a button under program control with a command like:
set the visible of button "MyButton" to false

I would like to be able to hide a column of a datagrid on the fly. I have tried things like:
'set the visible of column "MyCol" of group "DataGrid 1" to false' - but I get an error message.

It can be done in the Property Inspector so there must be a way under program control.
Any suggestions?

Thanks,
Larry
Hi Larry,

Try:

Code: Select all

set the dgColumnIsVisible["myCol"] of grp "myDatagrid" to false
Where:
- myCol is the name of the column to hide
- myDatagrid is the name of the datagrid
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Hide DataGrid column on the fly

Post by Klaus » Tue Mar 27, 2012 10:54 pm

Hi Larry,

...
set the dgColumnIsVisible ["Your column name here"] of grp "Your datagrid here" to FALSE
..
Not tested, but should work :-)

Please load this PDF as the one and only DataGrid reference:
http://lessons.runrev.com/s/lessons/m/datagrid/pdf


Best

Klaus

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Hide DataGrid column on the fly

Post by Klaus » Tue Mar 27, 2012 10:55 pm

Damn, one minute too late for my excellent hint :D

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Hide DataGrid column on the fly

Post by lohill » Tue Mar 27, 2012 11:47 pm

Thank you Gentlemen,

The dgColumnsVisible command is not present on the eight or so pages of datagrid commands I keep in from of at all times. It has now been added to my list.

Regards,
Larry

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Hide DataGrid column on the fly

Post by lohill » Tue Mar 27, 2012 11:53 pm

Whoops - That should be dgColumnIsVisible - singular column 'invisible.

Thanks again

Post Reply