toggle data grid form view

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
keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

toggle data grid form view

Post by keram » Wed Feb 26, 2014 1:30 pm

Hi,

Is it possible to code the data grid form so that it will toggle between many-row view and 1 row view by clicking on the row?

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

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

Re: toggle data grid form view

Post by Klaus » Wed Feb 26, 2014 1:58 pm

Hi keram,

yes :D

I see 2 possible solutions.
1. place another (exact duplicate) datagrid "datagrid2" on top of the datagrid with MANY rows "datagrid1".
Pseudocode in grp "datagrid1", the one with many rows:

Code: Select all

on mouseup
  put the dgIndex of me into tIndex

  ## Prepare a new ARRAY with only ONE row in it to fill the other SINGLE row datagrid with this array
  put the dgDataofInde[tIndex] of me into tArray[1]

  lock screen
  hide grp "datagrid1"
  show grop "datagrid2"
  set the dgdata of grp "datagrid2" to tArray
  unlock screen
end mouseup
Then put this script into the SINGLE row datagrid:

Code: Select all

on mouseup
  lock screen
  hide grp "datagrid2"
  show grop "datagrid1"
  unlock screen
end mouseup
You get the picture :D

2. this would require much more scripting like temporarily storing the complete
dgdata of the datagrid, checking the current number of displayed row to determine
if we need to toggle from single to multi row etc...
In any case much more elaborate 8)


Best

Klaus

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: toggle data grid form view

Post by keram » Thu Feb 27, 2014 11:09 am

Hi Klaus,

Thanks for sharing these ideas.

I've asked this question to see if there are any other alternatives to the task I posted here:
http://ftp.runrev.com/forums/viewtopic.php?f=7&t=19339

However on your statement:
Klaus wrote:You get the picture
I can only answer: I got some kind of idea but not all is clear. But since it would involve 2 data grids instead of just 1 it may be even more complex and complicated than what I'm trying to accomplish with just 1 grid and 1 card.
I was hoping that there would be some way to change the row height according to the type of view I would chose. If there would be a way to set the row height in expanded line view to be as high as the data grid box itself...

Simon answered on my thread above so I'll try to accomplish that.

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: toggle data grid form view

Post by SparkOut » Thu Feb 27, 2014 11:38 am

I remember a webinar from 2009 where it was demonstrated how to have a datagrid view with rows of (in this case, employee data) and a "disclosure arrow" button. When you clicked on the button, the row view expanded to display more detailed information about the employee, including photos and personal summary. I will try and find a source for it. I think I probably have a copy downloaded but it will be a big file and I'm not sure about where to host it at the moment, so hopefully there is a link to a source already in existence.

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

Re: toggle data grid form view

Post by Klaus » Thu Feb 27, 2014 12:49 pm

Hi keram,
keram wrote:...But since it would involve 2 data grids instead of just 1 it may be even more complex and complicated than what I'm trying to accomplish with just 1 grid and 1 card.
I don't think that my couple of lines will be more complicated than managing
and scripting one datagrid to do what you want, you will see :D


Best

Klaus

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: toggle data grid form view

Post by Simon » Thu Feb 27, 2014 12:58 pm

Sorry, the toggle in the other post I was referring to is in the button "Check".
Easy to solve.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: toggle data grid form view

Post by keram » Thu Feb 27, 2014 5:37 pm

Simon wrote:Easy to solve.
yea, I believe you.

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

Post Reply