Resizable DataGrid Question

Trevor DeVore lists at mangomultimedia.com
Thu Oct 20 10:58:36 EDT 2011


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



More information about the use-livecode mailing list