DataGrids with no UI

Bob Sneidar bobs at twft.com
Wed Sep 26 18:49:33 EDT 2012


I don't think so Todd. Allow me to be the naysayer here. The data structure behind a datagrid is in fact an array. Working with arrays is lightening fast, and they can be fairly large, restricted by memory. If you need bigger, there's SQL. 

The problem with a datagrid is that the data that is "visible" is all that is loaded into the datagrid fields and such, plus one row above and below what is visible if I am not mistaken. The rest of the data is loaded as you scroll, and is actually contained in the numerically indexed array. 

It only seems like the datagrid as a whole is a kind of data object but that is just an illusion. A datagrid is an array with a GUI. The GUI may have a library that helps you sort, display and find things, but if you take a look at the datagrid library, that is the code that makes the datagrid work, they are simply manipulating arrays. 

Also, a datagrid would only be able to handle simple 2 dimensional arrays, and would not be able to support relational needs. Arrays cannot be sorted or searched by simple commands (a glaring omission if anyone wants to ask me) so you have to write an api for doing those things. There is no indexing, but that is perhaps moot given the size of your array is going to be necessarily limited. A datagrid without the gui is an array and an api library. 

In essence, it's like asking to have your butter spread out on your bread, only without the bread. Well just peel back the paper and take a bite, you see? No? Some of my analogies are a stretch I admit. ;-) Okay try this one. It's like taking apart the space shuttle because you want to use the seats in it. 

Bob


On Sep 26, 2012, at 2:11 PM, Todd Geist wrote:

> 
> Thanks but what I am looking for is not an Array. At least not just an Array.  And it is not a database, although it is probably bound to a database.
> 
> I am building a data binding library. I am sick to death of wiring up databases to LiveCode controls. Its all boiler plate BS and it needs to go away.  Andre's DataStore libraries inspired me to make an attempt at this based on his libraries.  The idea is that you simply "Bind" dataGrids to one of on Andres' "sources"  with a command like
> 
> BindGridToSource the long id of group id 1392, "contacts"
> 
> and your done.  You have 2 way binding from the Grid to the DB and back.  Changes made to the DB are reflected in any grids that happen to be bound to the same source. 
> 
> THEN you can also bind a Group or a Card to the DataGrid  with a command like this
> 
> BindControlToGrid theLongIDofTheGroup, the LongIDoftheGrid
> 
> And you get the same thing. 2 way binding between the Control and the grid.  Select a record in the Grid, and the Bound card or group is updated to show the same record.  Edit the data in the Group and the changes are automatically synchronized to the the Grid the DB and other Controls that happen to be bound to the same source and record.
> 
> Once you tell the library "what is bound to what" the library handles the rest.  Of course there are ways to easily over ride the default behavior if it is not what you need or want.  But out of the box, you just design your ui and you get persistence ( Thanks to Andre's libraries).
> 
> This is working really well, But sometimes I don't want or need the DataGrid to be visible. I still need, searching, selected items, sorbability etc. I just don't need the UI.  The Grid holds my "FoundSet of sorted records" if you will, even when I don't care to see the list, i still need something that can serve in the same capacity.
> 
> Yes I understand how to go about trying to build something like this starting with an array, probably a local array a Behavior so I could easily re-use it. THE question is/ was….  is it worth creating something with No ui. IS there anything to gain over just hiding the damn data grid, when I don't want it visible.
> 
> Todd
> 
> 
> On Sep 26, 2012, at 8:44 AM, Bob Sneidar <bobs at twft.com> wrote:
> 
>> Sometimes I need an array with only one dimension and one element. Oh wait! That's a variable! ;-)
>> 
>> Bob
>> 
>> 
>> On Sep 26, 2012, at 7:04 AM, Klaus on-rev wrote:
>> 
>>> hmm, DataGrid - UI = Array
>>> 
>>> So why not just use an array (global/local variable or even a custom property) to keep the data?
>>> At least that's what I would do :-)
>>> 
>>>> Thanks 
>>>> 
>>>> Todd
>>> 
>>> Best
>>> 
>>> Klaus
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> Todd
> 
> --
> Todd Geist
> ------------------------------------
> http://www.geistinteractive.com
> 805-419-9382
> 
> GoDraw
> Draw on Photos with FileMaker Go
> http://www.geistinteractive.com/godraw
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list