How do I get the index of a datagrid row?

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
charms
Posts: 122
Joined: Mon Feb 10, 2014 6:21 pm
Contact:

How do I get the index of a datagrid row?

Post by charms » Sat May 24, 2014 9:42 pm

Hi there,

I need to get the index of the current pData entry in the behaviour script. I have a button in the row template that requires the index for further processing.

Does anybody know how I can get it? I tried with dgIndex of me but somehow this doesn't work.

Code: Select all

on FillInData pData
    -- This message is sent when the Data Grid needs to populate
    -- this template with the column data. pData is the value to be displayed.
    
    -- Example:
   --set the text of field 1 of me to pData
   set the icon of button "iconBtn" of me to ("fs_" & pData & ".png")
   set the uIndex of button "iconBtn" to the dgIndex of me -- This is what I try to achieve but the index is empty!
end FillInData

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: How do I get the index of a datagrid row?

Post by bangkok » Sat May 24, 2014 9:50 pm

What about :

Code: Select all

put GetDataOfIndex(the dgIndex of me, the dgColumn of me) into theColumnValue
?

charms
Posts: 122
Joined: Mon Feb 10, 2014 6:21 pm
Contact:

Re: How do I get the index of a datagrid row?

Post by charms » Sat May 24, 2014 10:10 pm

Thanks Bangkok, this solved my problem.

Code: Select all

on FillInData pData
    -- This message is sent when the Data Grid needs to populate
    -- this template with the column data. pData is the value to be displayed.
    
    -- Example:
   --set the text of field 1 of me to pData
   set the icon of button "iconBtn" of me to ("fs_" & pData & ".png")
   set the uIndex of button "iconBtn" of me to the dgIndex of me
end FillInData

Post Reply