Resizable DataGrid Question

Mike Doub Mike at Doub.com
Thu Oct 20 16:31:39 EDT 2011


I have made all of your suggested changes and have verified that tIndex has
no value.   This seems really odd to me.

The reason that I was taking this approach was to accommodate my intention
of building the array for the data grid only once then using the following
to create different sortings:

dispatch "SortDataByKey" to group "contacts_grid" with \
         theKey, theSortType, theDirection, isCaseSensitive

Since I was not able to solve the index problem, I have since abandoned this
approach and am now sorting the data before building the dgData.  I am also
injecting special data into the dgData and both you and Pete suggested.

Thanks very much for your help.

-= Mike


-----Original Message-----
From: use-livecode-bounces at lists.runrev.com
[mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Trevor DeVore
Sent: Thursday, October 20, 2011 10:59 AM
To: How to use LiveCode
Subject: Re: Resizable DataGrid Question

On Wed, Oct 19, 2011 at 4:56 PM, Mike Doub <Mike at doub.com> wrote:
>
> on FillInData pDataArray
>   set the text of field "Name" of me to pDataArray["LastName"] & \
>         comma & space & pDataArray["FirstName"] & space & 
> pDataArray["MiddleName"]
>   put char 1 of fld "Name" of me into field "spacerLable" of me
>   put the dgControl of me into theGrid
>   put the dgIndex of me into tIndex
>

This line is correct. You have verified that tIndex has no value?


> -- get the index of the current grid item
>   put the dgIndexes of me into tList
>

The above line should really read put the dgIndexes of theGrid into tList. I
think your syntax probably works though as dgIndexes is defined as a setProp
in the data grid library script.


> -- get list of grid indexes in display order
>
>   put itemoffset(tIndex,tList) into toff
>

You should set the wholeMatches to true before executing the above line.


> --find the current index in the ordered list
>   put item (toff -1) of tList into tpreIndex
> -- get the index of the previous grid item
>   if tpreIndex = 0 then
>
>      set the visiable of group "spacer" of me to true
> -- we are the first grid item, so show the spacer
>   else
>      put the dgDataOfIndex[tpreIndex] of me into preData         -- get
the
> data for the previous grid item
>

The above line should be targeting the data grid.

put the dgDataOfIndex[tPreIndex] of theGrid


>      if char 1 of preData["LastName"] = field "spacerLable" of me then
>         set the visiable of group "spacer" of me to false
> -- no difference yet
>      else
>         set the visiable of group "spacer" of me to true
> -- we found a difference
>      end if
>   end if
> end FillInData


The above notes aside, have you considered inserting the "blanks" into your
data grid data array? When generating the array just insert your blank rows
and check for those rows in FillInData. It might be easier.

--
Trevor DeVore
Blue Mango Learning Systems

LiveCode Resources for Developers: http://livecode.bluemangolearning.com
_______________________________________________
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