Dynamic dataprovider in Datagrid combobox.
Hi,
i am using Flex 3. I have a data grid with first two rows having item renderers as ComboBoxes. What i want to implement is that, depending on my selection in the first combobox, the respective second combobox should get a dataprovider of my choice.
For e.g.
If I select the 1st combobox as India, then the adjacent combobox should have the cities in India.
If I select the 1st combobox as France, then the adjacent combobox should have the cities in France.
I dont have the values in any local variables. The values must be fetched at runtime because the list of Countries(in first combobox) is very exaustive so fetching the list of all cities for all countries would not be right. So for each selection of country i have to make an http service call to fetch the corresponding city list.
My question is how do i dynamically give the cities as dataprovider to each of the combo boxes in each row.
Hope my description is comprehensible enough.
Thanks
Sid.
HI,
Can you check the below code. If that is what you need.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="application1_initializeHandler(event)">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
// Defines your collections
[Bindable]
public var countriesData:ArrayCollection=new ArrayCollection([{label: 'India'}, {label: 'Brazil'}]);
[Bindable]
public var citiesData:ArrayCollection;
[Bindable]
public var collection:ArrayCollection=new ArrayCollection();
protected function application1_initializeHandler(event:FlexEvent):void
dataGrid.addEventListener("countryChanged", country_changed_handler);
collection.addItem({cityData:citiesData});
// Change this method to the remote callings.
// In the resultEvent you will change the citiesData collection.
protected function country_changed_handler(event:DataEvent):void
if (event.data == 'India')
dataGrid.selectedItem.cityData = new ArrayCollection([{label: 'Mumbai'}, {label: 'Delhi'}]);
else
dataGrid.selectedItem.cityData = new ArrayCollection([{label: 'São Paulo'}, {label: 'Rio de Janeiro'}]);
dataGrid.invalidateList();
public function addRow(event:MouseEvent):void{
//collection.addItem(new Object());
collection.addItem({cityData:citiesData});
public function dropRow(event:MouseEvent):void{
]]>
</mx:Script>
<mx:DataGrid id="dataGrid"
dataProvider="{collection}">
<mx:columns>
<mx:DataGridColumn>
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox dataProvider="{this.parentDocument.countriesData}"
labelField="label"
change="combobox1_changeHandler(event)"
selectedIndex="-1">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.ListEvent;
protected function combobox1_changeHandler(event:ListEvent):void
dispatchEvent(new DataEvent("countryChanged", true, true, this.selectedLabel));
]]>
</mx:Script>
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn>
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox labelField="label">
<mx:Script>
<![CDATA[
override public function set data(value:Object):void
super.data = value;
var prevSelectedItem:Object = this.selectedItem;
this.dataProvider = data.cityData ;
this.selectedItem = prevSelectedItem;
]]>
</mx:Script>
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:HBox width="299" horizontalAlign="center" horizontalGap="51">
<mx:Button label="Add" click="addRow(event)"/>
<mx:Button label="Drop" click="dropRow(event)"/>
</mx:HBox>
</mx:Application>
Similar Messages
-
DataGrid Combobox dataprovider erasing items
I have a DataGrid that is linked to an array of custom data objects which I call a seriesList. You are supposed to be able to choose the name of each series via a combobox in the datagrid. It works fine except when the user selects the combobox and then clicks somewhere else in the interface, which closes the combobox and erases whichever item is previously selected!
<!-- Definition in application -->
<!-- axis.seriesList is and ArrayCollection of actionscript objects called SeriesObjects which have a var name:String variable -->
<mx:DataGrid id="seriesTable" color="black" fontSize="9" rowHeight="30" editable="true" resizeEffect="slow" rollOverColor="#CCCCCC"
selectionColor="#999999" dataProvider="{axis.seriesList}" width="100%"
rowCount="{axis.seriesList.length > 2 ? axis.seriesList.length : 2}" >
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name" width="280" headerStyleName="centered" id="nameColumn"
rendererIsEditor="true" editorDataField="result" itemRenderer="renderer.SeriesBoxRenderer"/>
</mx:columns>
</mx:DataGrid>
<!-- SeriesBoxRenderer -->
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" horizontalAlign="center">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
// Define a property for returning the new value to the cell.
public var result:String="";
[Bindable]
private var dpValue:ArrayCollection;
private function init():void {
// list of possible names to choose from for this series
dpValue = mx.core.Application.application.seriesArray;
// Override the set method for the data property.
override public function set data(value:Object):void {
if (dpValue == null) init();
super.data = value;
if (value != null) {
var currentValue:String = value.name;
var len:int = dpValue.length;
for (var i:int = 0; i < len; i++) {
if (dpValue[i].name == currentValue) {
editor.selectedIndex = i;
return;
editor.selectedIndex = 0; }
public function onChange():void {
var index:int = editor.selectedIndex;
result = dpValue[index].name;
data.name = dpValue[index].name;
]]>
</mx:Script>
<mx:ComboBox id="editor" textAlign="left" labelField="name" dataProvider="{dpValue}" change="onChange()"/>
</mx:VBox>I'm thinking the problem may be the dataprovider for the combobox. This array is also shared with another List component in another tab on the interface. The reason I am thinking this is because I have another item renderer which uses a combobox and does not erase itself when you click nothing. Here is the code for that item, and the only difference I can see between this code and the code that doesn't work is the fact that the dataprovider is shared with another part of the code. Still not sure how to fix this, however.
[Bindable]
private var dpValue:ArrayCollection;
private function init():void {
dpValue = mx.core.Application.application.aquisitionOptions.lastResult.system.data;
for ( var i:int=0; i<dpValue.length; i++ ) { //loop over the items in the dataProvider
if (dpValue[i].id == data.aquisitionID) { //compare desired value to current item.data value
editor.selectedIndex = i; //set the seletedIndex of the combo box
data.aquisitionDescr = dpValue[i].name;
break;
// Override the set method for the data property.
override public function set data(value:Object):void {
super.data = value;
if (dpValue == null) init();
if (value != null) {
var currentValue:String = value.aquisitionDescr;
trace ("\n current: ", currentValue);
var len:int = dpValue.length;
for (var i:int = 0; i < len; i++) {
if (dpValue[i].name == currentValue) {
editor.selectedIndex = i;
return;
editor.selectedIndex = 0;
public function onChange():void {
var index:int = editor.selectedIndex;
result = dpValue[index].name;
data.aquisitionDescr = dpValue[index].name;
data.aquisitionID = editor.selectedItem.id as String;
]]>
</mx:Script>
<mx:ComboBox id="editor" labelField="name" dataProvider="{dpValue}" change="onChange()"/>
<!-- definition in the datagrid -->
<mx:DataGridColumn dataField="aquisitionDescr" headerText="Data Aquisition" width="160" headerStyleName="centered" id="acquisitionColumn"
rendererIsEditor="true" editorDataField="result" itemRenderer="renderer.AquisitionBoxRenderer"/> -
Combobox with dynamic dataProvider
I have a very simple code:
private function showAvailableLabels(resultXML:XML, param:Object):void
if (resultXML.children().length() == 0)
Alert.show("Sku " + sku.text + " not found!", "Error");
else
labels.dataProvider = "";
labels.dataProvider = resultXML.availablelabels;
labels.validateNow();
labels.setFocus();
labels.selectedIndex = 0;
That code assigns different dataProvider to a combobox at the run time. I cannot get the exact pattern, but after a few times the combobox starts showing data from a previous data assignment. Do I have to refresh it somehow?
ThanksHere is a runnable demo I have put together using provided code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="switchDataProvider()"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768">
<fx:Script>
<![CDATA[
private var model_1:XML = <VFPData>
<availablelabels>
<filename>193</filename>
<id>10</id>
</availablelabels>
</VFPData>
private var model_2:XML = <VFPData>
<availablelabels>
<filename>192</filename>
<id>9</id>
</availablelabels>
<availablelabels>
<filename>160down</filename>
<id>25</id>
</availablelabels>
</VFPData>
private var current:XML = model_1;
private function switchDataProvider():void
current = current==model_1?model_2:model_1;
comboBox.dataProvider = current.availablelabels;
]]>
</fx:Script>
<mx:VBox>
<mx:ComboBox id="comboBox" labelField="filename"/>
<mx:Spacer height="10"/>
<s:Button click="switchDataProvider()" label="Switch"/>
</mx:VBox>
</s:Application>
Click on the push button and check the content of the combo, you should 192 from previous data. -
(URGENT) Skining problem of components (datagrid & combobox)
Hi,
I m using FLASH CS3, I used Datagrid and Combobox component from components panel, and simply add some data inside in that.
setupComboBox();
function setupComboBox():void
cb.setSize(200, 22);
cb.prompt = "Select a Credit Card";
cb.addItem( { label: "MasterCard", data:1 } );
cb.addItem( { label: "Visa", data:2 } );
cb.addItem( { label: "American Express", data:3 } );
import fl.controls.DataGrid;
import fl.controls.dataGridClasses.DataGridColumn;
import fl.data.DataProvider;
import fl.events.DataGridEvent
var dp:DataProvider = new DataProvider();
dp.addItem({col1:"item 1.A", col2:"item 1.B", col3:"item 1.C"});
dp.addItem({col1:"item 2.A", col2:"item 2.B", col3:"item 2.C"});
dp.addItem({col1:"item 3.A", col2:"item 3.B", col3:"item 3.C"});
dp.addItem({col1:"item 4.A", col2:"item 4.B", col3:"item 4.C"});
myDataGrid.addColumn("col1");
myDataGrid.addColumn("col2");
myDataGrid.addColumn("col3");
myDataGrid.dataProvider = dp;
myDataGrid.setSize(300, 200);
myDataGrid.move(10, 10);
It seems working fine.
My problem is , I want two different type of skining of two different component(DataGrid & Combobox). in the same fla.
.. e.g if datagrid have gray color skin type and combobox have black color skin type.
Can any one have any Idea?Thanks for reply..
@kennethkawamoto2
I already implemented that thing , that u suggest, The Main problem of this component is CellRenderer, what's the solution of it ?
If i apply this
cb.setStyle("upSkin", ComboBox_upSkin2);
cb.setStyle("overSkin", ComboBox_overSkin2);
cb.setStyle("downSkin", ComboBox_downSkin2);
Its change the header of Comobo box pattern, but the rest part e.g cell is remaining the same.
I tried like this also
cb.setStyle("upSkin",CellRenderer_upSkin2)
cb.setStyle("downSkin",CellRenderer_downSkin2)
cb.setStyle("overSkin",CellRenderer_overSkin2)
cb.setStyle("disabledSkin",CellRenderer_disabledSkin2)
cb.setStyle("selectedDisabledSkin",CellRenderer_selectedDisabledSkin2)
cb.setStyle("selectedUpSkin",CellRenderer_selectedUpSkin2)
cb.setStyle("selectedDownSkin",CellRenderer_selectedDownSkin2)
cb.setStyle("selectedOverSkin",CellRenderer_selectedOverSkin2)
but it gives error........
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::LabelButton/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::List/drawList()
at fl.controls::List/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::List/scrollToIndex()
at fl.controls::SelectableList/scrollToSelected()
at fl.controls::ComboBox/open()
at fl.controls::ComboBox/onToggleListVisibility()
When u click on combobox to open it up. The Component Assets of datagrid and combobox are the same so I am not able to apply different skin pattern of this two different component ..
Still is there any way pls let me .. -
Applicatoopn root / dynamic dataProvider for itemEditor
How to reach the main application instance from a custom
datagrid itemEditor component? I need to use data in the
application for dataProvider of that ComboBox itemEditor.I think you should always be able to do
Application.application. -
Populating dynamic values in the combobox with XML form Builder.
I am trying to populate dynamic value in the combobox with xml form builder. I see the document saying create property group and document property Id with respecitive values. I am able to create the property group with system admin -> System config
-> KM -> CM -> Global services -> property Metadata -> groups with new button. and I am trying to create document property Id with value. I am not able to find the way to give value in the property. I am using EP 7.0 Sp 14. Please let me know how to sovel itHi
You can create new property metadata with System Admin > System Config > KM > CM > Global services > Property Metadata > Properties > New. Specify the values for this metadata as the ones you need to have in the combo box. Use allowed values parameter of the matadata to sepcify the values. Each metadata property will have unique property ID and you can map this property ID to your combo box in xml forms.
Give it a try.
Regards,
Yoga -
Flex 3 : XML File as DataProvider to a Combobox
Hi,
I am uisng Flex 3 for our Application Front End
I am having an External XML file as shown
<states>
<state>Andhra<state>
<state>Telangana<state>
<state>Rayalseema<state>
<state>Maharatsthra<state>
</states>
and with lots of data ---etc
I am having a Combobox , how can use this Above XML file as Dataprovider to my Combobox
please sugest , thanks .Thanks
jfb00 , i will try and let know if i face issues . -
How to set boundry value in dynamic rows in datagrid
hi friends,
I am new to flex.i want to add dynamic rows to datagrid that means.once i enter the first record i want to press tab button then it will automatically go to the second row.and update the record continuously.once it reach the maximum value means the next row will not be edit.
mxkimum value =10000
from value to value percentage
0.01 2000 10
2000 8000 20
8000 10000 30
after it reach 10000 next row will not edit,this is i want how i do this please help.
If any suggession tel
thanks
B.venkatesanHi,
As Armin said use the following:
wdContext.nodeXXX().currentXXXElement().setAttributeValue("attributeName", value)
Here you give the value as value of simpleType and not its description.
thanks & regards,
Manoj -
How do I give the radio buttons a buttongroup and id dynamically as the datagrid is populated?
I am using the following component as an item renderer for a
<mx:DataGridColumn>
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
>
<mx:HBox horizontalAlign="left" left="10">
<mx:RadioButton />
<mx:RadioButton />
<mx:RadioButton />
<mx:RadioButton />
<mx:RadioButton />
</mx:HBox>
</mx:Canvas>
How do I give the radio buttons a buttongroup and id
dynamically as the datagrid is populated?"nikos101" <[email protected]> wrote in
message
news:g83gfl$m8o$[email protected]..
>I am using the following component as an item renderer
for a
><mx:DataGridColumn>
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
>
> <mx:HBox horizontalAlign="left" left="10">
> <mx:RadioButton />
> <mx:RadioButton />
> <mx:RadioButton />
> <mx:RadioButton />
> <mx:RadioButton />
> </mx:HBox>
> </mx:Canvas>
>
> How do I give the radio buttons a buttongroup and id
dynamically as the
> datagrid is populated?
What is your actual goal? -
DataGrid ComboBox itemRenderer/editor not updating dataProvider properly
I have a DataGrid with one column using a ComboBox as the itemRenderer. The column is editable but if you trace the dataProvider, the changes lag behind by one. So uncheck two row's ComboBox and the dataProvider only shows one row's data updated.
Any ideas?Yep, its a CheckBox, too early in the morning.
Another component (DataGrid) will be filtered depending on what rows in the ADG have their CheckBox checked, so leaving the row may be too late.
Here is the code I have so far. In the itemEditEnd event handler I'm trying to set the field in the dataProvider manually, but it causes an infinite loop. preventDefault and stopImmediatePropagation don't help.
----- CheckBoxRenderer.mxml -----
<?xml version="1.0"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.CheckBox;
[Bindable] public var newSelected:Boolean;
]]>
</mx:Script>
<mx:CheckBox id="selectedChbx" selected="{data.FLAG}"/>
</mx:VBox>
----- mainapp.mxml -----
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.events.AdvancedDataGridEvent;
import mx.collections.ArrayCollection;
import mx.controls.CheckBox;
[Bindable] private var transactions:ArrayCollection = new ArrayCollection([
{orderID: "33725", theirOrderNumber: "10170", name: "Bob Smith", SKUs: "21", PICKS: "50", FLAG: "true"},
{orderID: "33729", theirOrderNumber: "10172", name: "Mary Wilson", SKUs: "3", PICKS: "6", FLAG: "true"},
{orderID: "33730", theirOrderNumber: "10176", name: "Fred Carson", SKUs: "1", PICKS: "2", FLAG: "true"},
{orderID: "33731", theirOrderNumber: "10177", name: "Morten Hills", SKUs: "5", PICKS: "16", FLAG: "true"},
{orderID: "33732", theirOrderNumber: "10178", name: "Bill Trundy", SKUs: "5", PICKS: "34", FLAG: "true"},
{orderID: "33734", theirOrderNumber: "10179", name: "Ocean Boat Supply", SKUs: "8", PICKS: "19", FLAG: "true"},
{orderID: "33736", theirOrderNumber: "10180", name: "Janet Aberdine", SKUs: "5", PICKS: "18", FLAG: "true"},
{orderID: "33737", theirOrderNumber: "10181", name: "Kim Restine", SKUs: "2", PICKS: "6", FLAG: "true"},
{orderID: "33738", theirOrderNumber: "10182", name: "Thomas Overby", SKUs: "5", PICKS: "12", FLAG: "true"}
public function handleGridChanged(evt:AdvancedDataGridEvent):void{
var newData:Boolean = CheckBoxRenderer(evt.currentTarget.itemEditorInstance).newSelected;
trace(evt.rowIndex);
var obj:Object = transactions.getItemAt(evt.rowIndex);
trace("BEFORE: " + obj.FLAG);
obj.FLAG = newData;
trace("AFTER: " + obj.FLAG);
transactions.setItemAt(obj, evt.rowIndex);
return;
evt.preventDefault();
evt.stopImmediatePropagation();
// for each(var item:Object in transactions){
//trace(item.FLAG);
]]>
</mx:Script>
<mx:Label fontSize="12" text="Bulk Print / Pull - Step 1"/>
<mx:HBox>
<mx:AdvancedDataGrid id="dgTransactions" dataProvider="{transactions}"
fontSize="12" editable="true" sortableColumns="true" height="500"
width="100%" itemEditEnd="handleGridChanged(event);">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="orderID" headerText="WMSOID" width="100"
editable="false" textAlign="center"/>
<mx:AdvancedDataGridColumn dataField="theirOrderNumber" headerText="Order #"
textAlign="center" width="130" editable="false"/>
<mx:AdvancedDataGridColumn dataField="name" headerText="Customer"
width="125" textAlign="left" editable="false"/>
<mx:AdvancedDataGridColumn dataField="SKUs" headerText="SKU's"
width="75" textAlign="right" editable="false"/>
<mx:AdvancedDataGridColumn dataField="PICKS" headerText="Picks"
width="75" textAlign="right" editable="false"/>
<mx:AdvancedDataGridColumn dataField="FLAG" headerText="I" width="20" textAlign="center"
editable="true" rendererIsEditor="true" editorDataField="newSelected"
itemRenderer="CheckBoxRenderer"/>
</mx:columns>
</mx:AdvancedDataGrid>
<mx:DataGrid>
</mx:DataGrid>
</mx:HBox>
</mx:Application> -
DataGrid scroll positions resetting with dynamic dataprovider
Hi - I have a DataGrid that is backed by an ArrayCollection
that is fairly dynamic. Before doing my updates, i disable
autoupdating, and though my size is typically fixed at 100 items,
sometimes those items will be replaced. My problem is that a user
who has scrolled down the visible grid, will lose their scroll
position when i replace items. If i'm just doing updates on the
existing objects, it's fine, but the replace is causing the scrolls
(both horizontal and vertical) to reset. I've tried to isolate
where this is happening (whether set verticalScrollPosition or on
the bookmark) and i can't quite find it.
Anyone know how i can prevent this behavior? I've tried
capturing the scoll position before i begin my updates, and then
setting it back when finished, but it doesn't work.
Thanks.
./paulActually, I spoke too soon. I had a number of things I was
trying. And when i tried to clean up the other things that I
believed were extraneous (including an override of
makeColumnsAndRows), the vertical scroll resetting stopped working.
I've spent about 90 minutes trying to get back to where I was (wish
the builder was in IntelliJ!).
When it was working, I also tried to add horizontal scroll
capturing, and that didn't seem work either. I have 34 columns, the
first one is locked. When I captured my position, I saw it was 11.
Then i performed the update, and callLater my resetScroll position.
The first column i saw after the locked column is correct. However,
the scroll bar itself is fully left. On the next update I captured
a horizontal scroll of zero.
./paul -
Datagrid combobox as itemrenderer problem.
Hi All,
I have different problem. i have a datagrid with10-20 rows. Different item renderers in all columns(6 - 10 columns). In that a single column has combobox as item rederer.
I have to serve different dataprovider for each row's combobox. I assigned dataprovider by overriding data property. is this right?.
while my datagrid has scrollbar frequently my rows are refreshing. This makes bad my app.
Please help me.Yes, what you are doing is right, if you think that once the data provider is set on the combobox, and it does not change(except the selected value) then do not assign the data provider from override.
I would create a dirty flag in the combo itemrend and set this to true once the dataprovider is set on the combo, and will not set the dp again when the override data is called by looking at this dirty flag. -
Adding Dynamic column to datagrid at the begining of datagrid
Hello friends,
There is one datagrid which is static. and i m adding one dynamic column. it is get added to the end of the static datagrid
but I want to add dynamic column at the begning of the datagrid can anybody help me on this.
Thanking you,
Regards,
gajananThanks to everybody.
finally i got the things to work using following code.
private function SwapGridColumns (DG:DataGrid, Col1:Number, Col2:Number):void
var i:Number; // Counter
var DP:ArrayCollection =ArrayCollection( DG.dataProvider); //DataProvider
var Widths:Array = new Array (); // the widths of the columns
var Columns:Array = new Array (); // the column names
var Visibility:Array = new Array (); // visibility of columns
var HRenderer:Array = new Array (); // Header Renderer of columns
var IRenderer:Array = new Array();
var datastore:Array = new Array ();
var Editable:Array = new Array();
var DFields:Array=new Array();
var Sortable:Array = new Array();
for (i = 0; i<DG.columns.length; i++)
if (i == Col1)
Columns.push(DG.columns[Col2].headerText);
Widths.push(DG.columns[Col2].width);
Visibility.push(DG.columns[Col2].visible);
HRenderer.push(DG.columns[Col2].headerRenderer);
IRenderer.push(DG.columns[Col2].itemRenderer);
Editable.push(DG.columns[Col2].editable);
Sortable.push(DG.columns[Col2].sortable);
DFields.push(DG.columns[Col2].dataField);
else if (i == Col2)
Columns.push(DG.columns[Col1].headerText);
Widths.push(DG.columns[Col1].width);
Visibility.push(DG.columns[Col1].visible);
HRenderer.push(DG.columns[Col1].headerRenderer);
IRenderer.push(DG.columns[Col1].itemRenderer);
Editable.push(DG.columns[Col1].editable);
Sortable.push(DG.columns[Col1].sortable);
DFields.push(DG.columns[Col1].dataField);
else
Columns.push(DG.columns[i].headerText);
Widths.push(DG.columns[i].width);
HRenderer.push(DG.columns[i].headerRenderer);
IRenderer.push(DG.columns[i].itemRenderer);
Editable.push(DG.columns[i].editable);
Sortable.push(DG.columns[i].sortable);
DFields.push(DG.columns[i].dataField);
// Reset the widths
var col:Array
for (i = 0; i < Columns.length; i++)
var DGC:DataGridColumn = new DataGridColumn(Columns[i]);
DGC.width = Widths[i];
DGC.visible = Visibility[i];
DGC.headerRenderer = HRenderer[i];
DGC.itemRenderer = IRenderer[i];
DGC.dataField=DFields[i];
DGC.sortable=Sortable[i];
DGC.editable=Editable[i];
datastore.push(DGC);
DG.columns=datastore;
// Load DP
DG.dataProvider = DP;
Regards,
gajanan -
DataGrid/ComboBox/ItemEditor
Hi all,
I've got a DataGrid, "dg", whose dataprovider is set to an
array of "thing" objects.
Each row then has several columns using a custom renderer, a
canvas containing a combobox. The combobox's dataprovider is set to
thing's array of "subthing" objects. The editorDataField for each
row is set to "selectedItem".
When a combobox is changed, I need to set Thing.subthing =
combobox.selectedItem. Unfortunately I can't make this happen.
If I don't include a "selectedItem" variable within the MXML
component definition, I get the following RTE on focus out of the
combobox:
ReferenceError: Error #1069: Property selectedItem not found
on renderers.worksheet.SubThingComboBox and there is no default
value.
Once I add selectedItem, then I get this RTE:
ReferenceError: Error #1069: Property null not found on Thing
and there is no default value.
Basically, how do I map the selectedItem of the combobox to
Thing.subThing?The override set data() method returns a reference to the
current "thing". On combo box change, you can use this reference to
set the property in the thing item.
If you do not know what the "overide set data()" method is,
you need to study some more on itemRenderers. There are several
examples on cflex.net and many elsewhere on the net.
Tracy -
Hi,
I have a datagrid with a dataprovider.
And,I am trying to set the number of columns and column
headerText values of that Datagrid based on the values from an
array.
Any suggestions on how we can do this or does anybody has
already worked on this?
Those suggestions would of very great help to me.Assume that your colum information is contained in the Array
columnInfo which is not your dataProvider. Assume "dg" is the ID of
your DataGrid control.
var columns:Array = new Array(); // this will hold the
DataGridColumns
for(var c:int=0; c < columnInfo.length; c++) {
var col:DataGridColumn = new DataGridColumn();
col.headerText = columnInfo[c].headerText; // or whatever
holds the header text
col.dataField = columnInfo[c].dataField; // or what holds the
name of the field in the dataProvider
columns.push(col);
dg.columns = columns; // columns now added to the
DataGrid.
Maybe you are looking for
-
question about app itune, it automatically charge money from my card on Apr/24th, but i have not buy any music or any apps on that day!! what's wrong ??
-
Error in merge statement when trying to impliment SCD type 2 using merge...
Hi , I'm trying to impliment SCD type 2 using Merge using below blog as reference but sime how it is erroring out with error http://www.made2mentor.com/2013/08/how-to-load-slowly-changing-dimensions-using-t-sql-merge/ Msg 207, Level 16, State 1, Line
-
Has anyone been able to get a repair/proper fix from Apple for their LCD?
The more I use my Macbook Pro while traveling the more i notice the 'sparkly/grainy' display. Compared to the White/Black Macbook it is obviously noticable what i'm talking about - especially on white backgrounds. My question is - has anyone been abl
-
How do I MOVE images WITHOUT COPYING, please?....
In Aperture 3.5.1 on Mac OS 10.9.1 and I have no accounts such as Flickr or Facebook listed in Aperture Account Preferences. Project A has no Albums and Project B has various Albums containing images which were directly imported from camera... I wish
-
Hi, I need to get the difference between two dates (in days) in a calculated field, can anyone help me? Best Regards