dgDataOfLine Verification
Bob Sneidar
bobs at twft.com
Tue Jan 31 18:12:01 EST 2012
>
> On Jan 31, 2012, at 11:35 AM, Terry Judd wrote:
>
>>
>> On 01/02/2012, at 06:12 AM, Bob Sneidar wrote:
>>
>>> Hi all.
>>>
>>> I was given to understand that the dgDataOfLine referenced the visible lines of a datagrid, so that if I scrolled to the bottom of a datagrid that had 8 visible lines, the dgDataOfLine[8] would give me the mast line of data. It seems this is not so, unless something has gone wrong in my datagrid. Instead I am getting the data from the 8th record not the last of 8 visible records.
>>>
>>> What am I doing wrong? I will dig into this myself, but I am hoping for a quick "that's not the way to do it" from someone.
>>>
>>> Bob
>>
>> Bob - use getDataOfLine(8) to get the data for the 8th selected line irrespective of how the column data is sorted.
>>
>> Terry...
>>
>>
> Thanks Terry. Looks GetDataOfLine gets a key of a line, but the line is still a reference to the line in the data grid data, not the visible line. So if I have 15 lines with 8 visible, and I am scrolled to the bottom of the data grid and I want the last of the 8 visible lines, using getDataOfLine(8, "uniqueid") will give me uniqueid of the the 8th record, not the 15th, you see? The 8th visible line is the 15th *actual* line.
>
> I came up with a way to do it though, but it assumes that the row height is fixed. You simple div the dgVScroll with the dgprops["row height"] and you have the number of previous (non-visible) rows. Now you can add that to the visible row number and you have the row to pass to dgDataOfLine. Kludgy but it works.
>
> Might be a nice to include in the datagrid library a dgDataOfVisibleLine property that takes into account variable row heights. I think I will add that to the QCC.
>
> Bob
Never mind. I just discovered dgVisibleLines(). DOH! <note to self: read the datagrid library first>
More information about the use-livecode
mailing list