datagrid visible columns

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rinzwind
Posts: 135
Joined: Tue May 01, 2012 10:44 am

datagrid visible columns

Post by rinzwind » Wed Jun 01, 2016 2:37 pm

Is it possible to set the visible columns of a datagrid 'at once' instead of looping through each column and setting dgColumnIsVisible... thats slow (btw that property doesnt even check if the setting set is the same as the current setting, so causes unnecessary delays... thats why I check it myself before setting it)

Would be nice if theres something like set the visibleColumns of group "dg1" to "col1,col3,col4"

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: datagrid visible columns

Post by dave.kilroy » Wed Jun 01, 2016 2:52 pm

Hi - changing the visibility property of a range of datagrid columns in a repeat loop should be very fast - if it's taking a long time maybe check you have 'lock screen' enabled...

Dave
"...this is not the code you are looking for..."

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

Re: datagrid visible columns

Post by Klaus » Wed Jun 01, 2016 2:53 pm

Hi rinzwind,

you can set this for TABLE datagrids:
...
column visibility
- Allows you to set the visible property for all columns at once. Line delimited list of boolean values.
## Looks like an error, we need to provide a COMMA delimited list, see below!
...
Example:
...
set the dgProps["column visibility"] of grp 1 to "false,true,true"
## Will hide the first column in your datagrid
...
Good advice:
Download the Datagrid docs in PDF format here: http://lessons.livecode.com/m/datagrid and read it at least about 20 times! :D


Best

Klaus

rinzwind
Posts: 135
Joined: Tue May 01, 2012 10:44 am

Re: datagrid visible columns

Post by rinzwind » Wed Jun 01, 2016 3:11 pm

woops... column visibility it is. Thanks! Makes all the difference!

edit: hmm it does not improve things much, a little slower even (guess to do with that it not checks if a column really needs a change of visibility (current state could already be what the new setting is).. little bug and not looking too good at the result made me think it was fast. Well.. it's not a show stopper but just a bit slow and a bit weird, because something like reordering columns is fast.

Hmm what helps is put the dgData into a temp var, set it to empty, do the column thing, set it back.

Post Reply