I'm starting to play with Data Grids and I'm having some trouble with a situation.
I created a data grid and in the template I defined:
- a button
- a lable (ID)
- a lable (Name)
What I need is to pass the ID to a new stack that will open when I click on the button on the row, so, I thought that the best way to do it was to add the ID as a custom property of the button on the template.
this is the datagrid row behaviour
Code: Select all
on FillInData pDataArray
set the tknId of button "tokenOptions" to pDataArray["tokenId"] -- this is the button
set the text of field "tokenId" of me to pDataArray["tokenId"]
set the text of field "tokenName" of me to pDataArray["tokenName"]
end FillInData
Code: Select all
on mouseUp
put the tknId of me into tID
answer "Will show options dialog here!!! (tokenID = " & tID & ")"
end mouseUp
Them I have a button on my application to add a new row
Code: Select all
on mouseUp
put "1000" into theDataA["tokenId"]
put "New Token" into theDataA["tokenName"]
put 1 into theLineNo
dispatch "AddData" to group "tokensDataGrid" with theDataA, theLineNo
put the result into theNewIndex -- integer if successful, error string otherwise
end mouseUp
but when I add more rows, the name and id on the label is OK but when I click on the button of the new lines, the answer is blank ""
Anyone has any idea why this is happening? is there any better way to do this? (get the ID of the item on the row when clicking in the button of the row)
Many thanks in advance for any help you can provide.
- Miguel