ArrayCollection for dataProvider
Hello every one,
I'm a new french user here, so please be gentle :)
My problem is that i'm trying to get a good arraycollection
from my xml entirely in as3.
I've already created my advancedDataGrid, put columns on it,
I've also tried to put direct data on it and it works like
that:
var colDatas:ArrayCollection = new ArrayCollection(
[{COL1:"test",COL2:"toust"}]);
but my problem is that i don't understand how to get a
correct arrayCollection dynamicaly from my xml.
here is my XML:
?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DONNEES>
<WS COL1="CL" COL2="********" COL3="GENERAL" COL4="BOULOC"
COL5="31620" COL6="FRANCE" COL7="11" COL8="22" COL9="CONTACT"
COL10="A" srowid="" srecid="279" ligne="1" />
<WS COL1="AF" COL2="ABODINO33" COL3="ABODINO33" COL4="4
CHEMINS (LES)" COL5="12500" COL6="FRANCE" COL7="101" COL8="102"
COL9="888" COL10="A" srowid="" srecid="345" ligne="2" />
<WS COL1="CL" COL2="ALAIN66" COL3="ALAIN" COL4="PERPIGNAN"
COL5="66000" COL6="FRANCE" COL7="" COL8="" COL9="" COL10="A"
srowid="" srecid="428" ligne="3" />
<WS COL1="CL" COL2="BONNY31" COL3="BONNY" COL4="TOULOUSE"
COL5="31000" COL6="FRANCE" COL7="" COL8="" COL9="" COL10="A"
srowid="" srecid="426" ligne="4" />
</DONNEES>
and here is the code i wrote and which does'nt work:
public function modifDataList(pEvt:Event):void{
var dataXml:XML = new XML(pEvt.target.data);
var resultArray:Array = new Array();
var nbColumnsData:Number = dataXml.WS.length();
for(var j:Number = 0;j<nbColumnsData;j++){
var obj:Object = new Object();
var attribNb:Number = dataXml.WS[j].attributes().length();
for(var k:Number = 0;k<attribNb;k++){
obj[k]=dataXml.WS[k].attributes();
trace(obj[k]);
resultArray.push(obj);
var colDatas:ArrayCollection = new
ArrayCollection(resultArray);
advDataGrid.dataProvider= colDatas;
my goal is to make it dynamic because i don't receive the
same number of attributes with all xmls.
If you have any suggestion...
thank you all.
Theory looks good. Where is it failing?
Tracy
Similar Messages
-
Strange Behaviour on DataGrid with ArrayCollection as DataProvider
I have a Datagrid with an ArrayCollection as DataProvider, the arrayCollection is partially generated by a remoteObject call, the dataprovider seems to works at least until I try to edit the field...
By the RemoteObject I only receive an ArrayCollection with the field `ip`, but the datagrid looks for the fields ip, check and save...
If I add/edit this new field it works, but only under particular condition
The DataGrid:
<s:DataGrid id="datagrid" left="10" right="10" top="136"
dataProvider="{listaIPCheck}" bottom="10" requestedRowCount="4">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="ip" headerText="Asset"/>
<s:GridColumn dataField="check" headerText="Inventory"/>
<s:GridColumn dataField="save" headerText="Salvataggio"/>
</s:ArrayList>
</s:columns>
</s:DataGrid>
The Script:
[Bindable]private var listaIPCheck:ArrayCollection;
private function ro_resultHandler(event:Event=null):void
listaIPCheck = new ArrayCollection();
listaIPCheck = ro.getListUpdate.lastResult;
heap = 0;
// Read Below {POINT #1}
init3();
private function init3():void
// Read Below {POINT #2}
if (heap<listaIPCheck.length)
// omitted the initialization of the process p
p.addEventListener(NativeProcessExitEvent.EXIT, onExit);
try{
p.start(startupInfo);
}catch(e:Error){}
private function onExit(e:NativeProcessExitEvent):void {
// Read below {POINT #3}
Here is my code, now as you can see there are 3 line where I wrote to read below...
Let's assume to put this simple `for` instead of the commented line (once at a time)
for (var k:Number=0;k<listaIPCheck.length;k++)
listaIPCheck.getItemAt(k).check = "checkVal";
listaIPCheck.getItemAt(k).save = "saveVal";
This code always work in the 3 points, so at the end of the call the ArrayCollection is always filled with the new values, but the datagrid refresh the items only in POINT #1 and POINT #2
Why not in Point #3???Thank you Amy, but adding the properties in the server side did not work...
The workflow of the program is that:
1) I get the ArrayCollection (listaIPCheck) contatining some information (function ro_resultHandler)
2) I start an external process and grab the output data (function init3)
3) read and use the data from the process (function onExit)
Now the problem I have is regarding the refresh of the datagrid, this datagrid has the ArrayCollection (listaIPCheck) as DataProvider.
So:
- If I put the for loop instead of the comments ( // Read Below {POINT #1} ) or
( // Read Below {POINT #2} ) it works, the ArrayCollection is updated and the datagrid is refreshed
- Whereas if I put the for loop instead of ( // Read Below {POINT #3} ) , it won't work.. or at least, the ArrayCollection is correctly updated, but the datagrid is not refreshed at all and I have to use .refresh() -
Multiple ArrayCollection as DataProvider
Hi,
I've multiple source of XML which are saved as multiple
ArrayCollections in Flex. I've a single datagrid, which shows some
of the each ArrayCollection's elements in it. How could I
merge/throw those multiple ArrayCollection as DataProvider in the
datagrid?
Any help..?
ASBYou will need to concatenate the ArrayCollections into one,
as there is no way to specify multiple dataProviders for a single
control. This might be easier to do within XML (before wrapping it
in an ArrayCollection), depending on what your data looks
like. -
Do you need to have an array within an arraycollection for
the arraycollection to run the filterfunction properly?
<mx:ArrayCollection id="arrColl">
<mx:source>
<mx:Array>
<mx:Object name="ColdFusion" value="0.00" />
<mx:Object name="Dreamweaver" value="0.12" />
<mx:Object name="Fireworks" value="1.01" />
<mx:Object name="Flash" value="0" />
<mx:Object name="Flash Player" value="-0.00" />
<mx:Object name="Flex" value="0.00" />
<mx:Object name="Illustrator" value="2.92" />
<mx:Object name="Lightroom" value="0.32" />
<mx:Object name="Photoshop" value="0.06" />
</mx:Array>
</mx:source>
</mx:ArrayCollection>"nikos101" <[email protected]> wrote in
message
news:gb07gv$9v8$[email protected]..
> Do you need to have an array within an arraycollection
for the
> arraycollection
> to run the filterfunction properly?
>
> <mx:ArrayCollection id="arrColl">
> <mx:source>
> <mx:Array>
> <mx:Object name="ColdFusion" value="0.00" />
> <mx:Object name="Dreamweaver" value="0.12" />
> <mx:Object name="Fireworks" value="1.01" />
> <mx:Object name="Flash" value="0" />
> <mx:Object name="Flash Player" value="-0.00" />
> <mx:Object name="Flex" value="0.00" />
> <mx:Object name="Illustrator" value="2.92" />
> <mx:Object name="Lightroom" value="0.32" />
> <mx:Object name="Photoshop" value="0.06" />
> </mx:Array>
> </mx:source>
> </mx:ArrayCollection>
You have to have an Array within the ArrayCollection for it
to do anything,
since ArrayCollection is just a wrapper for Array... -
ArrayCollection for combo box - null vlaue
I have defined an ArrayCollection like this:
public var typename:ArrayCollection = new ArrayCollection(["Simple" , "Complex"]);
In mxml file,
the usage is,
<mx:ArrayCollection id = "sample">
<mx:Object dataField = "type" dataType = "Array" dataProvider = "{com.values.typename}" editable = true updatable = "true"/>
</mx:ArrayCollection>
In screen, i get the drop down with a null value. I want only two values dropped down , Simple and Complex.
Where does this null field come from??1. your arrayCollection should be bindable:
[Bindable]
public var typename:ArrayCollection = new ArrayCollection(["Simple" , "Complex"]);
2. What is com.values? Is that a reference to a class? If you store typename in a class, you can do two things:
a. Store it as a static var:
public static var typename....
and then reference it as MyClass.typename
b. Store it in a singleton class and then reference it as MyClass.getInstance().typename
3. How do you populate your comboBox? Where is it in your code?
Dany -
Changing/Assigning the username and password for dataprovider.
I'm creating a simple login screen, that would take the username and password from textboxes and replace those (mines actually) that was used in the dataprovider when the IDE sets the DP up when binding to an object. If someone has another approach I'm open to suggestions.
I'd look in the Keychain first.
-
Flex 3: syntax for populating ArrayCollection by loop
Hi, I'm a newb. I can't find an example of how to do this. Any examples would be greatl appreciated.
I want to chart some engineering data by populating my chart's dataprovider with an array collection (so far no problem). I want to poulate the array collection by looping through a math expression and I can't figure out the syntax for that. For example...
[Bindable]
private var myChartData:ArrayCollection = new ArrayCollection([
{vertNum:100, horizNum:100}
I want to loop through and add more points programmatically so if I loop 5 times I end up with...
[Bindable]
private var myChartData:ArrayCollection = new ArrayCollection([
{vertNum:100, horizNum:100},
{vertNum:110, horizNum:110},
{vertNum:43, horizNum:120},
{vertNum:88, horizNum:130},
{vertNum:140, horizNum:140},
// etc...
The number of horizontal variables to plot ould be in the hundreds, so I don't want to set up a huge static array collection with expressions in each location. I'd prefer to solve the expression as a loop iterates and populate the array collection as it goes. But I haven't got a clue how to 'word' that.
thanks!Here is an example of adding data points from a simple formula using a random number generator and scaling the randomness up. The process is just to create a new Object for each iteration of the loop and add the object to your ArrayCollection. You can assign as many properties to the object as you need, which can be helpful for using one ArrayCollection that is displayed in multiple charts.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="build_model()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private function build_model():void {
var obj:Object;
var chartAC:ArrayCollection = new ArrayCollection();
for (var i:uint = 0; i < 100; i++) {
obj = new Object();
obj.horizNum = 100 + 10 * i;
obj.vertNum = i * Math.random();
chartAC.addItem(obj);
linechart1.dataProvider = chartAC;
]]>
</mx:Script>
<mx:LineChart left="10" right="10" top="54" bottom="10" id="linechart1">
<mx:series>
<mx:LineSeries displayName="Series 1" yField="vertNum" xField="horizNum"/>
</mx:series>
</mx:LineChart>
<mx:Button x="10" y="10" label="Build Model" click="build_model()"/>
</mx:Application>
Chris -
Help with creating objects for ArrayCollection
Hi all,
I am trying to update an ArrayCollection with Objects created
in ActionScript
In the end the array collection will provide data to a chart
I can add the objects to my arrayCollection and access the
values of the properties via text field output but the data is not
Bindable
So my text field shows the values from my AC but my chart
isn't getting the dataAaffordableWeb:
Wrapping the Object in an ObjectProxy seems to have worked in
that the properties are bound but my Chart shows nothing.
I have posted the code below (keep in mind its a work in
progress)
Any help would be appreciated.
//////Code
<?xml version="1.0"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="handleResult(event);">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
import mx.utils.ObjectProxy;
//// set price change range for the four arrays
[Bindable]
public var nPchange:Array = new Array(-12, -11,
-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0);
[Bindable]
public var pPchange:Array = new Array(12, 11,
10,9,8,7,6,5,4,3,2,1,0);
//// Set up temprary var
[Bindable]
public var tempval:*;
[Bindable]
public var tempval2:*;
[Bindable]
public var tempvaly:*;
[Bindable]
public var tempvalr:*;
[Bindable]
public var tempvalr2:*;
[Bindable]
public var tempvalry:*;
[Bindable]
public var ylovert:Array = new Array;
[Bindable]
public var rylovert:Array = new Array;
[Bindable]
public var ymin:*;
[Bindable]
public var testarray:Array;
/// declare the lPrime ac
// declare the rprime ac
[Bindable]
public var rPrime:ArrayCollection = new ArrayCollection();
// declare rylover ac
[Bindable]
public var ryLover:ArrayCollection = new ArrayCollection();
// declare ylover ac
[Bindable]
public var yLover:ArrayCollection = new ArrayCollection();
/// declare default cMargin
[Bindable]
public var cMargin:* = 80;
[Bindable]
public var lPrime:ArrayCollection;
public function handleResult(event:FlexEvent):void
pedata();
public function pedata():*{
/// begin loop
lPrime = new ArrayCollection();
for(var n:int = 0; n < nPchange.length; n++){
var value:* = nPchange[n];
if(value == 0){value = .0001;}else{value = value;}
tempval = -1 * value / (cMargin + value);
tempval2 = (tempval / value);
ylovert.push(tempval2);
var o:Object = new Object;
o.PriceChange= value;
o.PriceElasticity= tempval2;
lPrime.addItem(new ObjectProxy(o));
} // end loop
lprime.xField= "PriceChange";
lprime.yField= "PriceElasticity";
lprime.dataProvider = lPrime;
///last brkt
]]>
</mx:Script>
<mx:AreaChart id="myChart" showDataTips="true"
mouseSensitivity="25" width="100%" >
<mx:horizontalAxis>
<mx:LinearAxis maximumLabelPrecision="1" title="Pricec2a"
minimum="-12" maximum="12"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis displayName="Price Elasticity to Break
Even" minimum="-1.5" maximum="-1" />
</mx:verticalAxis>
<mx:series>
<mx:AreaSeries id="lprime" form="curve" >
<mx:areaFill>
<mx:SolidColor color="red"/>
</mx:areaFill></mx:AreaSeries>
</mx:series>
</mx:AreaChart>
<mx:Text id="txt2"
text="{lPrime.getItemAt(3).PriceElasticity}"/>
</mx:Application> -
ArrayCollection field as ComboBox dataProvider question
I have an ArrayCollection defined like this:
public var test:ArrayCollection = new ArrayCollection([
{ Id:"one", Amount:2000 },
{ Id:"two", Amount:1000 },
{ Id:"three", Amount:200 } ]);
And i would like to make 'Id' field of 'test' ArrayCollection
as dataProvider for a ComboBox compoenent but can't figure it out
how.I tried with following but get an error:
comboName.dataProvider = test.Id;
Can someone please help me with this?
thanks in advanceDang, i totally forgot about 'labelField' property which
solves the problem:
comboName.labelField = "Id";
:) -
Progress bar for chart dataProvider?
I have a chart which has for dataProvider a link to a php
script which processes data and returns XML.
The processing takes a little bit of time so from flex the
user stares at a blank graph for some time.
Is there anyway to link a progress bar to this loading
process?
If I load the script directly from the browser, the browser's
progress bar (bottom right in IE) is more or less accurate. I would
like the equivalent from within flex.
Any input appreciated, thanks!
sample:
<mx:PlotChart
id="molecularChart"
width="100%" height="100%"
dataProvider="
http://www.blabla.com/processing.php"
showDataTips="true">
...If you are trying to update the progress bar display when your upload is 10%, 20%, , , x% complete, then you have to 'pretend' that the progress bar display corresponds to the percentage completness of your file upload. I believe that there is no other way to get around this without comprimising the speed of your upload.
Check out the swing forum, I believe there is a lot of discussion on this topic. -
XML as dataProvider for Charts
I want to display XML exported from Oracle Database as a chart......
The xml has the following structure :
<ROWSET>
<ROW>
<ORDER_ITEMS_ID>1</ORDER_ITEMS_ID>
<ORDER_ID>1</ORDER_ID>
<PRODUCT_ID>1</PRODUCT_ID>
<UNIT_PRICE>1200</UNIT_PRICE>
<QUANTITY>1</QUANTITY>
</ROW>
<ROW>
<ORDER_ITEMS_ID>2</ORDER_ITEMS_ID>
<ORDER_ID>7</ORDER_ID>
<PRODUCT_ID>1</PRODUCT_ID>
<UNIT_PRICE>1100</UNIT_PRICE>
<QUANTITY>3</QUANTITY>
</ROW>
</ROWSET>
I've seen many chart examples using ArrayCollection as DataProvider . using the same way , i tried to set xml . But no results.
Can you please suggest me how to set an XML as dataprovider ? ( or XMLList or XMLlistcollection )
( i'm developing a small app in AIR )Sample app from Adobe's livedocs:
XML:
<data>
<result month="Jan-04">
<apple>81768</apple>
<orange>60310</orange>
<banana>43357</banana>
</result>
<result month="Feb-04">
<apple>81156</apple>
<orange>58883</orange>
<banana>49280</banana>
</result>
</data>
Application:
<?xml version="1.0"?>
<!-- charts/XMLFileDataProvider.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Model id="results" source="../assets/data.xml"/>
<mx:Panel title="Line Chart">
<mx:LineChart id="myChart" dataProvider="{results.result}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="month"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="banana" displayName="Banana"/>
<mx:LineSeries yField="apple" displayName="Apple"/>
<mx:LineSeries yField="orange" displayName="Orange"/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{myChart}"/>
</mx:Panel>
</mx:Application>
Tanu -
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. -
How can we enter the data dynamically from datagrid to an arraycollection?
Hi All
How can we make datagrid fields editable when it is in empty position i mean the datagrid doesn't have any data to display.. and it must accept the data and update the arraycollection dynamically..
Now in my Application the datagrid is empty and it is not accepting any values and it still remain ideal.. i am unable to edit the datagrid fields in the datagrid .....
Please some one tell me how can i achieve this...Here is a very basic example.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable] private var _dataProvider:ArrayCollection;
private function onCreationComplete():void {
_dataProvider = new ArrayCollection();
for(var i:int = 1; i <= 100; ++i)
_dataProvider.addItem({ROW:i,A:"",B:"",C:"",D:"",E:"",F:"",G:"",H:"",I:"",J:"",K:"",L:"", M:"",N:"",O:"",P:""});
]]>
</mx:Script>
<mx:Panel title="Editable DataGrid Example" height="472" width="584" horizontalCenter="0" verticalCenter="0">
<mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{_dataProvider}" editable="true" horizontalScrollPolicy="on" sortableColumns="false" draggableColumns="false">
<mx:columns>
<mx:DataGridColumn dataField="ROW" headerText="" width="30" sortable="false" draggable="false" editable="false" paddingLeft="0" paddingRight="0" textAlign="right"/>
<mx:DataGridColumn dataField="A" headerText="A" width="100"/>
<mx:DataGridColumn dataField="B" headerText="B" width="100"/>
<mx:DataGridColumn dataField="C" headerText="C" width="100"/>
<mx:DataGridColumn dataField="D" headerText="D" width="100"/>
<mx:DataGridColumn dataField="E" headerText="E" width="100"/>
<mx:DataGridColumn dataField="F" headerText="F" width="100"/>
<mx:DataGridColumn dataField="G" headerText="G" width="100"/>
<mx:DataGridColumn dataField="H" headerText="H" width="100"/>
<mx:DataGridColumn dataField="I" headerText="I" width="100"/>
<mx:DataGridColumn dataField="J" headerText="J" width="100"/>
<mx:DataGridColumn dataField="K" headerText="K" width="100"/>
<mx:DataGridColumn dataField="L" headerText="L" width="100"/>
<mx:DataGridColumn dataField="M" headerText="M" width="100"/>
<mx:DataGridColumn dataField="N" headerText="N" width="100"/>
<mx:DataGridColumn dataField="O" headerText="O" width="100"/>
<mx:DataGridColumn dataField="P" headerText="P" width="100"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>
Hope this helps -
Setting column for filter function
I've got the following code working for filtering data in a
grid, but it's currently hard-coded to only filter on the
"Character" column. (see the searchData function) I'm capturing the
string for the column that should be searched in the filterColumn
variable, but now I'm stuck as to how to 'inject' that string into
the IF statement of the searchData function. If someone can offer
an explanation I'd appreciate it.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private function init():void {
initData();
setFilterColumn();
[Bindable]
private var dataList:ArrayCollection ;
private function initData():void{
dataList= new ArrayCollection([
{character:"Peter Gibbons", actor:"Ron Livingston"},
{character:"Joanna", actor:"Jennifer Aniston"},
{character:"Michael Bolton", actor:"David Herman"},
{character:"Samir Nagheenanajar", actor:"Ajay Naidu"},
{character:"Lawrence", actor:"Diedrich Bader"},
{character:"Milton Waddams", actor:"Stephen Root"},
{character:"Bill Lumbergh", actor:"Gary Cole"},
{character:"Tom Smykowski", actor:"Richard Riehle"},
{character:"Anne", actor:"Alexandra Wentworth"},
{character:"Dom Portwood", actor:"Joe Bays"},
{character:"Bob Slydell", actor:"John C. McGinley"},
{character:"Bob Porter", actor:"Paul Wilson"},
{character:"Nina", actor:"Kinna McInroe"},
{character:"Brian", actor:"Todd Duffy"},
{character:"Drew", actor:"Greg Pitts"}
private function filterData():void{
dataList.filterFunction = searchData;
dataList.refresh();
private function searchData(item:Object):Boolean{
var isMatch:Boolean = false;
// character is hard coded below
if(item.character.toLowerCase().search(filterInput.text.toLowerCase())
!= -1){
isMatch = true;
return isMatch;
private function clearFilter():void{
dataList.filterFunction = null;
dataList.refresh();
filterInput.text = '';
[Bindable]
private var filterColumn:String;
private function setFilterColumn():void {
filterColumn = columnCombo.selectedItem.value;
]]>
</mx:Script>
<mx:HBox verticalAlign="middle">
<mx:Label text="Filter:" />
<mx:ComboBox id="columnCombo"
change="setFilterColumn()">
<mx:dataProvider>
<mx:ArrayCollection id="views">
<mx:Object label="Character" value="character" />
<mx:Object label="Actor" value="actor" />
</mx:ArrayCollection>
</mx:dataProvider>
</mx:ComboBox>
<mx:TextInput id="filterInput" change="filterData()"
/>
<mx:Button label="Clear" click="clearFilter()" />
</mx:HBox>
<mx:DataGrid dataProvider="{dataList}" width="400"
height="400">
<mx:columns>
<mx:DataGridColumn headerText="Character"
dataField="character" />
<mx:DataGridColumn headerText="Actor" dataField="actor"
/>
</mx:columns>
</mx:DataGrid>
</mx:Application>Josh Johnson a écrit :
> That definitely took me another step. To fit my
previously posted code, I
> edited your suggestion to this:
>
> public function searchData(item:Object):Boolean {
> var isMatch:Boolean=false;
> var pattern:RegExp = new
RegExp("^"+filterInput.text,"i");
> if (!item[String(columnCombo.selectedItem.value)].length
||
>
item[String(columnCombo.selectedItem.value)].match(pattern))
> isMatch=true;
> return isMatch;
> }
>
> This now works as advertised apart from one bug. It only
does matches to the
> beginning of the strings. (i.e if I type in "eter" it
wouldn't return "Peter
> Gibbons" through the filter.)
>
Just remove anchor 'start of string' from the regexp ("^").
new RegExp(filterInput.text,"i"); -
Why is it different using ArrayCollection and XMLListCollection?
As shown in the screenshot below. The first one has ArrayCollection as dataProvider. The second one has XMLListCollection as dataProvider.
I would like the result for XMLListCollection but now I only have ArrayCollection as input. How can I deal with it? Thanks!
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var dp:ArrayCollection = new ArrayCollection([
{name: "00:00:00", v1: "2"},
{name: "00:15:00", v1: "3"},
{name: "00:30:00", v1: "4"},
{name: "00:45:00", v1: "3"},
{name: "01:00:00", v1: "5"},
{name: "01:15:00"},
{name: "01:30:00"},
{name: "01:45:00"},
{name: "02:00:00"}
]]>
</mx:Script>
<mx:XMLListCollection id="dp2">
<mx:source>
<mx:XMLList>
<hour name="00:00:00" v1="2"/>
<hour name="00:15:00" v1="3"/>
<hour name="00:30:00" v1="4"/>
<hour name="00:45:00" v1="3"/>
<hour name="01:00:00" v1="5"/>
<hour name="01:15:00" />
<hour name="01:30:00" />
<hour name="01:45:00" />
<hour name="02:00:00" />
</mx:XMLList>
</mx:source>
</mx:XMLListCollection>
<mx:LineChart id="lineChart" height="100%" width="100%" dataProvider="{dp}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="name"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="v1" form="curve" displayName="v1"/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{lineChart}" direction="horizontal"/>
<mx:LineChart id="lineChart2" height="100%" width="100%" dataProvider="{dp2}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="@name"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="@v1" form="curve" displayName="v1"/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{lineChart2}" direction="horizontal"/>
</mx:Application>Define a default value to v1 for each of your objects in the ArrayCollection, or even better, use a strongly typed model class. In XML this would resolve to null (or maybe an empty string?), but an object will throw a "property not found" error, which may have unexpected results (as seen above).
Maybe you are looking for
-
Questions on the LRS network model.
On page 6-26 of the "Oracle Spatial Topology and Network Data Models" documentation, the example shows that measures are recorded in the 'roads' table (i.e. the one with the geometry of the feature). 1. Why in this example is 'null' used for Node 5 (
-
Multiple Projects Using the Same Video Files
I have just completed a video that has upwards of 500 clips of source video in a single Bin. Now, I want to create two new videos using some of the previously used video footage in addition to video from other projects completed a couple of years ago
-
My 2011 mac mini screen is black and has an "out of range" message
My 2011 mac mini is hooked up to a monitor and it has a black screen with an "out of range" message. I'm not sure how to fix it. everything is plugged in. please help!
-
Problem restoring applet focus
As an exercise I wrote a Tetris clone in Swing. The game itself is fine, and runs without problems when run standalone in a JFrame. Next, I tried making an applet version of the game. Mostly the same code, just wrapped inside of a JApplet instead of
-
Hello Expert, I need assistance with respect to DME file creation for UK client. My issue is with alignment, I have created the file as per the layout provided by the client but the problem is below. Client want the file in the below format, VOL1 HDR