Datagrid refresh resets option menus

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
DukeUK
Posts: 23
Joined: Sun Dec 06, 2009 5:55 pm

Datagrid refresh resets option menus

Post by DukeUK » Wed Oct 15, 2014 6:53 pm

Another datagrid question.

Briefly I need to copy some values from one datagrid (DG1) to another datagrid (DG2).

So I’ve copied the original values in DG2 into ‘theDataA’ and then added the values from DG1.

I’ve then updated DG2 with:

set the dgdata of group "DG2" to theDataA (I’ve also tried dispatch and send).

This all works absolutely fine as far as the contents of DG2 are concerned.

The problem is that there are two columns with option menus in DG2 and when I update DG2, it refreshes and resets these menus to the first option.

I’m not sure how to keep the menus at their initial value or how to reset them after the refresh?

Any help would be great. I'm stumped.

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

Re: Datagrid refresh resets option menus

Post by dunbarx » Wed Oct 15, 2014 9:51 pm

Here is my favorite response to datagrids:

I use them, but do not understand them.

However, it should be possible to save the menuHistories of the option buttons in a custom property and restore them after you refresh the whole DG. You will have to go inside the row template group script, I think.

Craig Newman

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

Re: Datagrid refresh resets option menus

Post by Klaus » Thu Oct 16, 2014 1:06 pm

Hi Duke,

sounds like you do not update the datagrid array data to the new selected labels/menu items of your menu buttons.

Couple of questions:
1. Do you have a routine in the "fillInData" handler of your datagrid that will set
the LABELS of your option menus according to the values in the array?

2. Do you have a "menupick" handler in your datagrid behavior (or the buttons tehmselves) that will SET these values
in the datagrid array, when the user selects any menu item from your option menus?


Best

Klaus

DukeUK
Posts: 23
Joined: Sun Dec 06, 2009 5:55 pm

Re: Datagrid refresh resets option menus

Post by DukeUK » Sat Oct 18, 2014 3:39 pm

I don’t think I’ll ever actually understand how datagrids work, but so long as I can get them to work, I can live with that .

Klaus, I didn’t have any of those routines in my scripts, but I’m playing around with that idea now and having some success.

Thanks

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

Re: Datagrid refresh resets option menus

Post by Klaus » Sat Oct 18, 2014 5:11 pm

Hi Duke,
DukeUK wrote:Klaus, I didn’t have any of those routines in my scripts, but I’m playing around with that idea now and having some success.
great! :D

Come back if you have more and/or specific questions!


Best

Klaus

Post Reply