expand and contract rows
Posted: Wed Oct 03, 2012 12:37 am
I am bringing data in from an external database and loading a datagrid.
This is the code that I am using (I had to make adjustments for extra spaces, returns and tabs because I'm calling this from a cold fusion site.. so that's why the script is a bit longer)
and this works great.
Now, I want my datagrid to expand and contract. So I looked at the instructions http://lessons.runrev.com/s/lessons/m/d ... d-contract and did everything - EXCEPT
in the sample, when the data is loaded, each record has: put false into theDataA[3]["expanded"]
In mine, I just have "set the dgText[firstLineAreNames] of group "DataGrid 22" to ptext" on the card level....
and then in the RowBehaviorScript, fillindata, I assign each field using this
...
I'm not sure why it understands "label 1, label 2, etc." but it works, so I've moved on. (i.e. I get very confused when I try to figure out how or whether I've converted it to an array or what an array is - but as long as it works, I'm happy).
But now, I don't know how to incorporate a field called "expanded" and putting false into it. Do I do that on the card level? on the rowbehaviorscript level? If I put a general
- put false into pDataArray["expanded"] - on the rowbehaviorscript level, it won't switch to true...because onclick, it runs through the rowbehaviorscript and sets it back to false.
Maybe this approach can't work and I have to use a button to switch it back and forth?
Probably a very simple thing, but it has me baffled right now.
This is the code that I am using (I had to make adjustments for extra spaces, returns and tabs because I'm calling this from a cold fusion site.. so that's why the script is a bit longer)
Code: Select all
put "http://www.mywebsite.com?email=" & temail & "&password=" & tpassword & "" into turl
put url(turl) into ptext
if char -1 of ptext is "" then
delete char -1 in ptext
end if
replace "xyz" with return in ptext
replace "usetab" with tab in ptext
put false into firstLineAreNames
set the dgText[firstLineAreNames] of group "DataGrid 22" to ptext
Now, I want my datagrid to expand and contract. So I looked at the instructions http://lessons.runrev.com/s/lessons/m/d ... d-contract and did everything - EXCEPT
in the sample, when the data is loaded, each record has: put false into theDataA[3]["expanded"]
In mine, I just have "set the dgText[firstLineAreNames] of group "DataGrid 22" to ptext" on the card level....
and then in the RowBehaviorScript, fillindata, I assign each field using this
Code: Select all
set the text of field "firstname" of me to pDataArray["label 1"]
set the text of field "label" of me to pDataArray["label 2"]
set the label of btn "contact_email" of me to pDataArray["label 3"]
set the label of btn "webname" of me to pDataArray["label 4"]
I'm not sure why it understands "label 1, label 2, etc." but it works, so I've moved on. (i.e. I get very confused when I try to figure out how or whether I've converted it to an array or what an array is - but as long as it works, I'm happy).
But now, I don't know how to incorporate a field called "expanded" and putting false into it. Do I do that on the card level? on the rowbehaviorscript level? If I put a general
- put false into pDataArray["expanded"] - on the rowbehaviorscript level, it won't switch to true...because onclick, it runs through the rowbehaviorscript and sets it back to false.
Maybe this approach can't work and I have to use a button to switch it back and forth?
Probably a very simple thing, but it has me baffled right now.