• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Urgent CFGrid-Combo-DataProvider Question

Contributor ,
Jun 29, 2006 Jun 29, 2006

Copy link to clipboard

Copied


Dear all,

I have this code to create combos in cfgrid. My question now is .. how to replace the hardcoded countries with query? The code is saved in AS file (.as). The full codes can be found at http://cfpim.blogspot.com/2005_08_01_cfpim_archive.html See Grid cellRenderer in Flash forms topic.

function createChildren(Void) : Void{
combo = createClassObject( ComboBox, "combo", 1, {owner:this});
combo.dataProvider = [{data:'SGP',label:'Singapore'}, {data:'JPN',label:'Japan'}, {data:'USA',label:'United States of America'}, {data:'AUS',label:'Australia'}, {data:'IND',label:'India'}];
combo.addEventListener("change", this);
}

Thanks in advance
Keiko

TOPICS
Advanced techniques

Views

510

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2006 Jun 29, 2006

Copy link to clipboard

Copied

Since nobody, especially me, appears to know, I am going to suggest something that may or may not work.

Something like:
<cfsavecontent variable="something">
function createChildren(Void) : Void{
combo = createClassObject( ComboBox, "combo", 1, {owner:this});
<cfoutput query="yourquery">
combo.dataProvider = [{data:'#code#',label:'#name#'}
<cfif currentrow lt recordcount>, </cfif>
</cfoutput>
];
combo.addEventListener("change", this);
}

</cfsaveconent>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 29, 2006 Jun 29, 2006

Copy link to clipboard

Copied

LATEST

Dan,

I wanted to try your method, but I got another error (if I take the content of .AS file and put it inside cfsavecontent). Below is my code ...

Seems that I cannot place import or createChild inside CFSaveContent. Any help will be very much appreciated.

Keiko
----------------------------------------------------------------------------------------------------------------

<cfform format="Flash" skin="haloSilver">

<cfsaveContent variable="onLoad">

import mx.controls.ComboBox;

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:'SGP',label:'Singapore'}, {data:'JPN',label:'Japan'}, {data:'USA',label:'United States of America'}, {data:'AUS',label:'Australia'}, {data:'IND',label:'India'}];
combo.addEventListener("change", this);
}

function getPreferredHeight(Void) : Number{
return combo != undefined ? 25:0;
}

function setValue(str:String, item:Object){
var val = item.country;
for(var i = 0; i < combo.dataProvider.length; i++){
combo.dataProvider .data == val ? combo.selectedIndex = i : '';
}
}

function change() {
listOwner.editField(getCellIndex().itemIndex, getDataLabel(), combo.selectedItem.data);
}

}

function(){
_level0.myGrid.rowHeight=25;
_level0.myGrid.getColumnAt(2).cellRenderer = GridRenderer;
}.call()

</cfsavecontent>

<!--- grid with 3 columns name, firstName, department --->
<cfgrid name="myGrid" width="400">
<cfgridColumn name="Name">
<cfgridColumn name="Country">
<cfgridrow data="Name 1, SGP">
<cfgridrow data="Name 2, USA">
</cfgrid>

<cfinput type="submit" name="cmdSubmit" 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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation