dataGrid help?

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
sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

dataGrid help?

Post by sturgis » Sat Apr 18, 2009 3:32 am

I have a question about handling datagrids.

I currently have an app with 2 datagrids, 1 form 1 table, both working mostly as expected.

In the form dataGrid I have a disclosure button working to hide or show more of the data line.

My question is this. If the user changes any of the 6 fields that are on the portion of the line that is affected by the disclosure button, when they are hidden, then shown again the line reverts back to initial values. How do I lock the user changes in?

I know I've see how to do this somewhere, but i've been reading so much its all become a blur. Could someone point me to the right resource or post or video so I can re-read whatever it was and move on to my next steps?

Thanks in advance, all the help here is much appreciated.

Sturgis

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Sat Apr 18, 2009 1:03 pm

The lesson How Can I Store An Option Menu Value When The User Makes a Selection? shows how you can use SetDataOfIndex/SetDataOfLine to update internal values in a data grid.

Note that in the current version of the data grid SetDataOfIndex does not store your data in the cache if you have "persistent data" checked in the Property Inspector. If that is an issue for you then you can get/set the dgDataOfIndex/dgDataOfLine property of the data grid. See the Data Grid API
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Post by sturgis » Sat Apr 18, 2009 4:11 pm

Thank you very much, got it working. Seems relatively easy to manage now that you've handed me a clue.

Much appreciated.
trevordevore wrote:The lesson How Can I Store An Option Menu Value When The User Makes a Selection? shows how you can use SetDataOfIndex/SetDataOfLine to update internal values in a data grid.

Note that in the current version of the data grid SetDataOfIndex does not store your data in the cache if you have "persistent data" checked in the Property Inspector. If that is an issue for you then you can get/set the dgDataOfIndex/dgDataOfLine property of the data grid. See the Data Grid API

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Post by sturgis » Sat Apr 18, 2009 4:53 pm

One more question if I may.

In a datagrid, table format. If I wish to set the numberformat for individual columns, must I setup custom column templates for each column? I need to be able to set a numberFormat on the fly while retaining the numeric sort for the column.

Any chance you could direct me to an example or resource again? Not sure why everything else has been so easy yet suddenly I'm struggling with things that are probably just as easy.

Thanks in advance (again) for any help.

Sturgis

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Mon Apr 20, 2009 5:36 pm

You can probabaly accomplish what you need by overriding the default behavior for table cells. This is easier than creating a custom template for each column. Take a look at this lesson which shows how to do just that:

How Do I Override the Default Behavior For Rendering Data to a Cell?
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Post by sturgis » Mon Apr 20, 2009 10:11 pm

Very cool, got things working well thanks! Am I blind, or was that part of the documentation a recent addition? Either way, thanks for leading me to it, and if its a recent add, thanks for that also!

Sturgis
trevordevore wrote:You can probabaly accomplish what you need by overriding the default behavior for table cells. This is easier than creating a custom template for each column. Take a look at this lesson which shows how to do just that:

How Do I Override the Default Behavior For Rendering Data to a Cell?

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Mon Apr 20, 2009 10:39 pm

I added it last week sometime so it is relatively new.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply