Here is the original Post

happylandcannedSoftware and s/w Development

Jul 2, 2012 (5 years and 1 month ago)

668 views


Axelology

Posted At : November 4, 2006 7:16 PM | Posted By : Axel Jensen
Use a combo box in a CFGrid

This is a great example, and it's great for learning what actionscript can do... It uses an import of an
actionscript file to put a combo box in a cell in a cfgrid... it's awesome.
View the example

Here is the original Post
I want to be able to remember this stuff so i blog it.

Grid.cfm
---------------
<cfif parameterExists(form.submit_btn)>

<CFDUMP var=
"#form#"
>

</cfif>


<cfform format=
"Flash"
skin=
"haloSilver"
width=
"400"
height=
"300"
>


<cfsaveContent variable=
"onLoad"
>

function(){
_level0.myGrid.rowHeight=25;
//applying the cellRenderer 'GridRenderer.as' to the 4th column
_level0.myGrid.getColumnAt(
3
).cellRenderer
= GridRenderer;
}.call()
</cfsavecontent>


<!--- grid with 3 columns name, firstName, department --->

<cfgrid name=
"myGrid"
>

<cfgridColumn name=
"name"
>

<cfgridColumn name=
"firstName"
>

<cfgridColumn name=
"department"
>


<cfgridrow data=
"Maegerman, Philippe, 1"
>

<cfgridrow data=
"Fonda, Nahuel, 2"
>

</cfgrid>


<cfinput type=
"submit"
name=
"submit_btn"
value=
"Submit to see the form dump"
>

<!--- onLoad trigger --->

<cfinput type=
"text"
visible=
"No"
width=
"0"
height=
"0"
name=
"trigger2"
bind=
"{1==2?'':#onLoad#}"
>


</cfform>

and here is the actionscript file that is needed, put them in the same directory, and it will work.
GridRenderer.as
-------------------
import mx.controls.ComboBox;
Ads by Google
Macromedia
Cfgrid
Flash Ria
Flash Apollo
MX


class GridRenderer extends mx.core.UIComponent{
var combo;
var listOwner : MovieClip;
var getCellIndex : Function;
var getDataLabel : Function;
function createChildren(Void) : Void{
combo = createClassObject( ComboBox,
"combo"
,
1
, {owner:this});
combo.dataProvider = [{data:1,label:'CF_Pim'}, {data:2,label:'AsFusion'}];
combo.addEventListener(
"change"
, this);
}
function getPreferredHeight(Void) : Number{
return combo != undefined ? 25:0;
}
function setValue(str:String, item:Object){
var val = item.department;
for(var i = 0; i < combo.dataProvider.length; i++){
combo.dataProvider[i].data == val ? combo.selectedIndex = i : '';
}
}
function change() {
listOwner.editField(getCellIndex().itemIndex,
getDataLabel(), combo.selectedItem.data);
}
}
View the example

Related Categories:
cfform

Comments (0)
|
Print
|
Send
|
del.icio.us


Comments
There are no comments for this entry.
[
Add Comment
]

C A L E N D A R
<<

March 2008

>>

Sun Mon Tue Wed Thu Fri Sat
1
2 3 4 5 6 7 8
9 10 11 12 13
14
15
16 17 18 19 20
21
22
23 24 25 26 27
28
29
R E C E N T E N T R I E S
KeyboardManagement for Games in Actionscript 3

360flex Europe, and my presentation code and slides

Timezone Issues with remote (Date/Time) data and flash

360flex, video games, and venting

Customizing the Flex Slider

Speaking at 360 Flex Atlanta


[Home Page]

C H A T
S E A R C H

D E V E L O P E R B L O G S
Maikel Sibbald

Brian Joseph (Flex MDI)

Ben Clinkinbeard (Flex MDI)

Brendan Meutzner (Flex MDI)

Mark Kruger (CF Guru)

Jake Churchill

Nicole Rutter

Ken Reiss

The Flex Show

Ray Camden

Ben Forta

Ryan Stille

Bruce Phillips

Mark Breneman

Alex Uhlmann

Jason Hawryluk [Flexible Experiments Blog]

Andy Mcintosh - Skinning

Jaun Sanchez - Skinning

Flex Examples

Doug Mccune

A R C H I V E S B Y S U B J E C T
Actionscript 2.0 (5)
[
RSS
]
cfeclipse (3)
[
RSS
]
cfform (6)
[
RSS
]
Coldfusion (18)
[
RSS
]
CSS (1)
[
RSS
]
Flash (2)
[
RSS
]
Flex 2.0 (65)
[
RSS
]
Flex Builder Tips (2)
[
RSS
]
General (7)
[
RSS
]
Google Maps (1)
[
RSS
]
Photoshop (1)
[
RSS
]
SQL (3)
[
RSS
]
Subversion (1)
[
RSS
]
Web (1)
[
RSS
]
Windows (2)
[
RSS
]
S U B S C R I B E
Enter your email address to subscribe to this blog.
R S S
30 31