Datagrids - getting line data from items checked
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 339
- Joined: Wed Jul 11, 2012 9:24 pm
Datagrids - getting line data from items checked
I know how to do this the awkward, lengthy way - but I am hoping there is a sleek way:
I want people to be able to check names on a datagrid and then click a button and have the button get the names that were checked and send them to me (in an http tag).
The lengthy way is for each time something is checked, it sends an http tag to update a remote database. But if there is a list of 15 people, that's http messages, which is rather stupid.
Instead, I would like to send one list in one http message
I can't use hilited line - because it's multiple lines... So I need some kind of loop that gets the dgline information, sees if the checked button is hilited, and if so, gives me the name.
So for the first part, if they check the checkbox, I have
if pmousebtnnum is 1 then
if the short name of the target is "check" then
setdataofline the dgline of me, "checked", the hilite of the target
end if
end if
I'm not sure how to loop through the datagrid to get the name
Thanks
I want people to be able to check names on a datagrid and then click a button and have the button get the names that were checked and send them to me (in an http tag).
The lengthy way is for each time something is checked, it sends an http tag to update a remote database. But if there is a list of 15 people, that's http messages, which is rather stupid.
Instead, I would like to send one list in one http message
I can't use hilited line - because it's multiple lines... So I need some kind of loop that gets the dgline information, sees if the checked button is hilited, and if so, gives me the name.
So for the first part, if they check the checkbox, I have
if pmousebtnnum is 1 then
if the short name of the target is "check" then
setdataofline the dgline of me, "checked", the hilite of the target
end if
end if
I'm not sure how to loop through the datagrid to get the name
Thanks
Re: Datagrids - getting line data from items checked
Hi Carolyn,
do you ever sleep?
Where exactly did you put this "mouseup" script?
Directly in the datagrid script or in a "custom behavior" for the datagrid or column?
Is the datagrid of type TABLE or FORM?
Best
Klaus
do you ever sleep?
Where exactly did you put this "mouseup" script?
Directly in the datagrid script or in a "custom behavior" for the datagrid or column?
Is the datagrid of type TABLE or FORM?
Best
Klaus
-
- Posts: 339
- Joined: Wed Jul 11, 2012 9:24 pm
Re: Datagrids - getting line data from items checked
About the sleep...Livecode makes me compulsive... In response to your question, it is a form.
OK. I figured out the first part, which is having the checkbox and updating the datagrid The item I am changing is the third item in the data that I am loading. theline is the line that was checked. Here is the code:
So that works...next step (unless you help me before that...) is to get all the data from the datagrid and send it to me via http
OK. I figured out the first part, which is having the checkbox and updating the datagrid The item I am changing is the third item in the data that I am loading. theline is the line that was checked. Here is the code:
Code: Select all
on mouseUp pMouseBtnNum
put the dgHilitedlines of group "DataGrid_meeting" into theline
put the dgdataofline[theline] of group "DataGrid_meeting" into theDataA
##put theDataA["label 3"] into twhat
##answer twhat & " is how we started"
if the hilite of button "invite" of me is true then
dispatch "SetDataOfLine" to group "datagrid_meeting" of card "outside_features" with theline, "label 3", "true"
else
dispatch "SetDataOfLine" to group "datagrid_meeting" of card "outside_features" with theline, "label 3", "false"
end if
put the dgdataofline[theline] of group "DataGrid_meeting" into theDatab
##put theDatab["label 3"] into twhat2
##answer twhat2 & " is how we ended"
end mouseUp
Re: Datagrids - getting line data from items checked
Hm, you answered exactly ONE question of four...
So what info do you need to extract from the datagrid?
theDataA already contains all data from the clicked (?) line of the datagrid!
So what info do you need to extract from the datagrid?
theDataA already contains all data from the clicked (?) line of the datagrid!
-
- Posts: 339
- Joined: Wed Jul 11, 2012 9:24 pm
Re: Datagrids - getting line data from items checked
Got the rest. Here's how you create the loop:
I put this in: http://mywebsiteusingcoldfusion.cfm?invite="& tinvite & "" and I'm there!
Code: Select all
put "" into tinvite
put the dgNumberOfLines of group "datagrid_meeting" into ttotallines
repeat with i = 1 to ttotallines
put the dgDataOfLine[i] of group "DataGrid_meeting" into theDataA
if theDataA["label 3"] is true then
put tinvite & "^" & theDataA["label 1"]&theDataA["label 2"] into tinvite
replace space with "" in tinvite
end if
end repeat
Re: Datagrids - getting line data from items checked
Aha, great
But why are your scripts so horribly (mis)formatted?
But why are your scripts so horribly (mis)formatted?