Problem with datagrid

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
CAsba
Posts: 432
Joined: Fri Sep 30, 2022 12:11 pm

Problem with datagrid

Post by CAsba » Fri Oct 20, 2023 2:09 pm

Hi,
I've been having some problems recently. This is the latest..
On clicking a button 'ShowAllCols'

with script

Code: Select all

set the dgColumnIsVisible ["code"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["description"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["quantity"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["discount"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["price"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["type"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["stock"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["discountedcost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["Min.purchqty"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["costperunit"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["dim1"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["dim2"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["dim3"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cut1"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cut2"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cut3"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["kgspurchased"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["kgscut"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["ltrspurchased"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["ltrscut"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["wastefactor"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["col 23"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["location"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["checkedqty"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["shortfall"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["reasonforshortfall"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["shortfallcost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["markup"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["nominalcost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["lfs"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cuttingfee"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["salesdiscount"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["Discrec"] of group "DataGrid 2" to true
   
I get an error message..

An error has occurred in behaviour for the Column Template
Chunk: error in object expression.

I checked that the DG still has all the columns listed in the script. This button has worked in the past - something has caused it to fail.
I've re-installed LC, re-started Windows.

Any one any ideas ?

I just tried making another button to change status of some of the cols, and it now seems to be working again.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Problem with datagrid

Post by dunbarx » Fri Oct 20, 2023 3:11 pm

CAsba.

Are you saying that the issue has (somehow) resolved?

Craig

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

Re: Problem with datagrid

Post by Klaus » Fri Oct 20, 2023 3:22 pm

Hi CAsba,

you can have it a BIT shorter :-)

Code: Select all

...
put the dgprops["columns"] of group "DataGrid 2" into tColumns
## Returns a CR delimited list of all column names
repeat for each line tColumn in tColumns
   set the dgColumnIsVisible[tColumn] of group "DataGrid 2" to true
end repeat
## Done!
...
Best

Klaus

CAsba
Posts: 432
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with datagrid

Post by CAsba » Fri Oct 20, 2023 4:29 pm

Yes, Craig.
Thanks Klaus.

Post Reply