Datagrid dataProvider Q
I am getting a query back from cf and putting it into a carigorm model
if is just put the query straight into a element of the model ie
public var currentPadItems:ArrayCollection = new ArrayCollection();
model.currentPadItems = event.result;
and then in the grid
dataProvider="{model.currentPadItems}"
this works fine
My problem is that i will be getting many different data sets that i will be displaying in simular grids so what i wanted to do was create an object with element that have a key of the uniqure data set and then a value of the query/ arraycollection so
public var currentPadItems1:Object = new Object();
model.currentPadItems1.a = event.result;
and ref in the grid as
dataProvider="{model.currentPadItems.a}"
this does not work even though when i debug and look at the two they are identical why is this?
this was answered by Bogdan Manate in my other fourm post "Binding Problems". He suggested to create a bindable class and then put that in the AC which worked
Similar Messages
-
Problem with datagrid dataprovider
I'm wondering why is it my search result is null after I press search button. After I press search, the datagrid is blank. But I ever test my service and it's working.
Anyone has any idea how to solve it? So sorry I'm totally new to FLEX... >.<
Below is my code...
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:productbasicservice="services.productbasicservice.*"
width="1024" height="768">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.TextInput;
import mx.events.DataGridEvent;
import mx.events.FlexEvent;
import mx.rpc.AsyncToken;
import valueObjects.Product_basic;
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
getProduct_basic_pagedResult.token = productbasicService.getProduct_basic_paged();
protected function saveClick(event:MouseEvent):void
productbasicService.commit();
protected function revertData(event:MouseEvent):void
productbasicService.revertChanges();
protected function searchData(event:MouseEvent):void
var searchStr:String = searchbox.toString();
searchProduct_basicResult.token = productbasicService.searchProduct_basic(searchStr);
dataGrid.dataProvider = searchProduct_basicResult.lastResult;
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getAllProduct_basicResult"/>
<productbasicservice:ProductbasicService id="productbasicService"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
showBusyCursor="true"/>
<s:CallResponder id="getProduct_basic_pagedResult"/>
<s:CallResponder id="searchProduct_basicResult"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:DataGrid id="dataGrid" x="11" y="61" width="1003" height="557"
creationComplete="dataGrid_creationCompleteHandler(event)"
dataProvider="{getProduct_basic_pagedResult.lastResult as ArrayCollection}" editable="true">
<mx:columns>
<mx:DataGridColumn width="200" dataField="id" editable="false" headerText="ID"/>
<mx:DataGridColumn dataField="name" headerText="name"/>
<mx:DataGridColumn width="200" dataField="price" headerText="Price"/>
<mx:DataGridColumn dataField="description" headerText="description"/>
</mx:columns>
</mx:DataGrid>
<s:Button x="849" y="22" label="Save" click="saveClick(event)"/>
<s:Button x="944" y="22" label="Revert" click="revertData(event)"/>
<s:TextInput x="14" y="22" width="367" id="searchbox"/>
<s:Button id="button" x="389" y="22" label="Search" click="searchData(event)"/>
</s:WindowedApplication>
I have added my own data service operation in the php file called searchProduct_basic(searchStr). Basically this function return the object of the search result.It's the same for lastResult as ArrayCollection.
protected function searchData(event:MouseEvent):void
var searchStr:String = searchbox.toString();
searchProduct_basicResult.token = productbasicService.searchProduct_basic(searchStr);
dataGrid.dataProvider = searchProduct_basicResult.lastResult;
For you information, the searchProduct_basic(searchStr) would return Product_basic object. >.< -
Datagrid dataprovider not updated after filterfunction/refresh applied.
I have a datagrid that has about 100 or so rows backed by an arrayCollection - no problems. I use a list of "topics" to filter the view in the datagrid, using a filterfunction assigned to the arrayCollection - no problem. The only editable data in the grid is a single column boolean value represented by a checkbox using an itemrenderer - no problem.
Problem: I change the state of several checkboxes for my current topic, I select a new topic, then change some check boxes under that topic. When I return to the first topic, the checkboxes are no longer checked - everything is as it was before. I would have thought the arraycollection (dataprovider) was getting updated when I changed the values of the checkboxes, but this does not appear to be the case.
So, do I need to handle an event to update the dataprovider manually before I change to a new topic, or should it work like I described and I am doing something wrong?
Thanks.Well that would be the problem then. Sometimes this can be done automatically, but most of the time there are some additional considerations you need to take. It sounds like maybe the data state of the render is getting wiped out before the edit is committed.
I suggest skimming over the following:
http://livedocs.adobe.com/flex/3/html/celleditor_1.html
Cheers! -
DataGrid dataProvider XML with Namespaces,
I have a DataGrid wich dataProvider is a XMLList. The problem
is that, the xml has a default namespace, and in my DataGridColumns
I use the dataField property to define wich XML field should be
displayed. The problem is that the dataField property is used in a
way that do not take into consideration the xml namespace.
I'm already using the use namespace directive with the right
namespace, but that doesn't work.
Has anyone tried to do something similar?This is similar to a problem I stumbled into described in
another post. What I ended up doing was creating a labelFunction
for each column and using the value (without the namespace) as the
element name. In ActionScript you can use the QName to get a child
element:
private function getItemValue(data:Object,
column:DataGridColumn):String {
return data.child(new QName(mb, column.dataField));
Note that "mb" was a namespace variable I declared at a
module level. I couldn't find a more elegant way of overcoming this
namespace deficiency of the built in controls. I suppose you could
also extend the DataGrid control, add a namespace attribute and
override the appropriate function that provides the default
rendering. However, that is something for another day.... Hope this
helps.
Dan -
I'm trying to get data that got returned by a php page to
well.. actually show up in the datagrid.
This is the data returned by php:
quote:
<projects>
<project>
<KKIreff>
54
</KKIreff>
<Klantreff>
45
</Klantreff>
<Datum>
2008-06-21
</Datum>
<Status>
Nieuw
</Status>
<GeplLev>
Nog niet gepland
</GeplLev>
<TotKasten>
666
</TotKasten>
</project>
<project>
<KKIreff>
4
</KKIreff>
<Klantreff>
5
</Klantreff>
<Datum>
2008-06-25
</Datum>
<Status/>
<GeplLev>
Nog niet gepland
</GeplLev>
<TotKasten>
5
</TotKasten>
</project>
</projects>
At each <project> a new row in the datagrid should come
up.
But nothing shows up in the datagrid. This is(part of) the
code in my flex app:In your handler, do this:
var xmlResult:XML = XML(event.result);
trace(xmlResult.toXMLString()); //to verify you have the data
you expect
var xlProjects:XMLList = xmlResult.project;
trace(xlProjects.length()); to verify your e4x expression
dgProjects.dataProvider = xlProjects;
Tracy -
Combining Datagrid Dataprovider with form fields
I am sorry I have know where else to go. I have a datagrid
that gets filled in with an ArrayCollection. One column is a check
box called "Include" So I would check a few records (rows) and then
I have some formfields. I want the form fields to get appended to
each datagrid record. I have this:
private function update():void {
var myobj:Object = new Object();
myobj.dba = dba.selectedLabel;
myobj.itemid = itemid.text;
myobj.item = item.selectedLabel;
myobj.programtype = programtype.selectedLabel;
myobj.status = status.selectedLabel;
myobj.priority = priority.selectedLabel;
myobj.descrip = descrip.text;
myobj.followup = followup.selected;
myobj.trackcomp = trackcomp.selected;
myobj.preslocal = preslocal.selected;
myobj.tracksales = tracksales.selected;
myobj.startdate = startdate.selectedDate;
myobj.enddate = enddate.selectedDate;
myobj.followdates = followdates.selectedDate;
cfdataInsert.addData({user:myobj})
//This is the part I am confused about!!
for (var i:int = 0; i < myAccounts.length; i++ ) {
var aAccounts:Account = myAccounts
cfdataInsert.update( aAccounts ) ;
}//end for loop
The "myObj" parts works. I dont know how to update the
arrayCollection (myAccounts) so that when Include is true add the
form fields to this and then INSERT into a DB.
I need to see a simple sample without other stuff clouding
what im trying to do. I am using a RemoteObject for the call to
fill the Datagrid. and another remote Object to send the results.
Can anyone help me with the syntax?
Thanks
GeorgeThanks for the reply, It did what you said but the foirm
field are not the same as the datgrid columns. I really want to
have my arraycollection that fills in the datagrid just add the
checked records to another arraycollection and then update a DB so
that each row from the datagrid has the firm field info with it.
George -
Hi All :D
I have a datagrid with an arrayCollection as its data
provider. One of the columns, named address, is the concatenation
of three addresses from my arrayCollection (address1, address2,
address3) My problem is I do not know how to implement that...
Kindly help :D
Thanks :D"JuggerOgre" <[email protected]> wrote in
message
news:gastg8$3ls$[email protected]..
> Hi All :D
>
> I have a datagrid with an arrayCollection as its data
provider. One of the
> columns, named address, is the concatenation of three
addresses from my
> arrayCollection (address1, address2, address3) My
problem is I do not know
> how
> to implement that...
labelFunction -
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> -
Updating the dataprovider of a datagrid
I have a datagrid with an arraycollection as the
dataprovider.In one of the columns there is a combobox used as the
itemeditor.I want the user to select values from the combobox and
when a submit button is clicked the datagrid dataprovider needs to
be updated.
Once the submit is pressed,he should not be able to change
the values using any of the comboboxes where he has already
selected some values.The only way I can see to do that would be to have the
database default to null values in all the columns, and then check
for that with your edit handler. We use managed collections at
work, which means a second collection would be required; one to
store the temporarily selected values, the other to stay connected
to the data in the dataBase. Edit the temporary collection, and
then when the Submit button is clicked, copy the temporary
collection over to the one linked collection. Maybe one of the more
experienced users on here has another solution? I don't know.
This is the kind of event handler I am talking about,
BTW: -
Simple dataProvider for dataGrid question
I have a question about accessing some values from an
xmllist. I have a piece of xml that is returned from an httpservice
that looks similar to this.
<topnode>
<list>
<item>value</item>
<item>value2</item>
<item>value3</item>
</list>
</topnode>
I'm interested in creating a datagrid to display the values
of each list.item, so: value, value2, value3. I'm not sure what my
data provider should look like in this case since there are no
nodes underneath the repeating node.
I can create an xml list like:
myList = event.result.list.item
but this gives me an xmllist with values of [0].item.value,
[1].item.value etc. I'm just unsure how to setup my datagrid to
extract values from the item node.
I think if my xml looked like the following I could access it
like:
(in my httpservice result handler)
myList = event.result as XML
(the datagrid provider would look like)
dataProvider={myList.item}
(and the column would have an entry like this)
dataField="name"
<topnode>
<list>
<item>
<name>bob</name>
</item>
<item>
<name>stan</name>
</item>
<item>
<name>bill</name>
</item>
</list>
</topnode>
But in my case, the value I'm extracting is the value set at
the top level node that repeats. Maybe I'm missing something
obvious here.
Any thoughts?Thanks again for responding. I've tried that, but when I do
all the values show up in the first row of the datagrid. Which
looks like this:
<item>value</item>
<item>value2</item>
<item>value3</item>
Perhaps I'm making an incorrect assumption below:
[Bindable]
public var myList:XMLList;
myList = event.result.list;
<mx:DataGrid dataProvider="{myList}" width="100%">
<mx:columns>
<mx:DataGridColumn headerText="Names"
dataField="item"/>
</mx:columns>
</mx:DataGrid>
xml from server:
<topnode>
<list>
<item>value</item>
<item>value2</item>
<item>value3</item>
</list>
</topnode> -
DataGrid does not display XML data
Hello, and thanks for reading this...
I am having a problem displaying XMLList data in a DataGrid.
The data is coming from a Tree control, which is receiving it
from a database using HTTPService.
The data is a list of "Job Orders" from a MySQL database,
being formatted as XML by a PHP page.
If it would be helpful to see the actual XML, a sample is
here:
http://www.anaheimwib.com/_login/get_all_orders_test2.php
All is going well until I get to the DataGrid, which doesn't
display the data, although I know it is there as I can see it in
debug mode. I've checked the dataField property of the appropriate
DataGrid column, and it appears correct.
Following is a summary of the relevant code.
...An HTTPService named "get_all_job_orders" retrieves
records from a MySQL database via PHP...
...Results are formatted as E4X:
HTTPService resultFormat="e4x"
...An XMLListCollection's source property is set to the
returned E4X XML results:
...The "order" node is what is being used as the top-level of
the XML data.
<mx:XMLListCollection id="jobOrdersReviewXMLList"
source="{get_all_job_orders.lastResult.order}"/>
...The "jobOrdersReviewXMLList" collection is assigned to be
the dataProvider property of a Tree list, using the @name syntax to
display the nodes correctly, and a change event function is defined
to add the records to a DataGrid on a separate Component for
viewing the XML records:
<mx:Tree dataProvider="{jobOrdersReviewXMLList}"
labelField="@name"
change="jobPosForm.addTreePositionsToDG(event)"/>
...Here is the relevant "jobPosForm" code (the Job Positions
Form, a separate Component based on a Form) :
...A variable is declared:
[Bindable]
public var positionsArray:XMLList;
...The variable is initialized on CreationComplete event of
the Form:
positionsArray = new XMLList;
...The Tree's change event function is defined within the
"jobPosForm" Component.
...Clicking on a Tree node fires the Change event.
...This passes an event object to the function.
...This event object contains the XML from the selected Tree
node.
...The Tree node's XML data is passed into the positionsArray
XMLList.
...This array is the dataProvider for the DataGrid, as you
will see in the following block.
public function addTreePositionsToDG(event:Event):void{
this.positionsArray = selectedNode.positions.position;
...A datagrid has its dataProvider is bound to
positionsArray.
...(I will only show one column defined here for brevity.)
...This column has its dataField property set to "POS_TITLE",
a field in the returned XML record:
<mx:DataGrid width="100%" variableRowHeight="true"
height="75%" id="dgPositions"
dataProvider="{positionsArray}" editable="false">
<mx:columns>
<mx:DataGridColumn width="25" headerText="Position Title"
dataField="POS_TITLE"/>
</mx:columns>
</mx:DataGrid>
In debug mode, I can examine the datagrid's dataProvider
property, and see that the correct XML data from the Tree control
is present. However, The datagrid does not display the data in any
of its 6 columns.
Does anyone have any advice?
Thanks for your time.Hello again,
I came up with a method of populating the DataGrid from the
selected Item of a Tree Control which displays complex XML data and
XML attributes. After the user clicks on a Tree branch, I call this
function:
public function addTreePositionsToDG(event:Event):void{
//Retrieve all "position" nodes from tree.
//Loop thru each Position.
//Add Position data to the positionsArray Array Collection.
//The DataGrid dataprovider is bound to this array, and will
be updated.
positionsArray = new ArrayCollection();
var selectedNode:Object=event.target.selectedItem;//Contains
entire branch.
for each (var position:XML in
selectedNode.positions.position){
var posArray:Array = new Array();
posArray.PK_POSITIONID = position.@PK_POSITIONID;
posArray.FK_ORDERID = position.@FK_ORDERID;
posArray.POS_TITLE = position.@POS_TITLE;
posArray.NUM_YOUTH = position.@NUM_YOUTH;
posArray.AGE_1617 = position.@AGE_1617;
posArray.AGE_1821 = position.@AGE_1821;
posArray.HOURS_WK = position.@HOURS_WK;
posArray.WAGE_RANGE_FROM = position.@WAGE_RANGE_FROM;
posArray.WAGE_RANGE_TO = position.@WAGE_RANGE_TO;
posArray.JOB_DESCR = position.@JOB_DESCR;
posArray.DES_SKILLS = position.@DES_SKILLS;
positionsArray.addItem(posArray);
So, I just had to manually go through the selected Tree node,
copy each XML attribute into a simple Array, then ADD this Array to
an ArrayCollection being used as the DataProvider for the DataGrid.
It's not elegant, but it works and I don't have to use a Label
Function, which was getting way too complicated. I still think that
Flex should have an easier way of doing this. There probably is an
easier way, but the Flex documentation doesn't provide an easy path
to it.
I want to thank you, Tracy, for the all the help. I checked
out the examples you have at www.cflex.net and they are very
helpful. I bookmarked the site and will be using it as a resource
from now on. -
How to get selected values (using checkBox) from DataGrid in flex.
i have a datagrid which is getting values from a XML file (getting this xml file from database using PHP and HTTP request in flex). i have created a checkbox in every row in data grid. and here is my requirement: i want to select tow or three check-box and would like to get all the values form that particular ROWs in some form , prefered arraycollection (such that i can pass this array directly to a bar chart) .. can some one help me as i am new to flex .
code ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="siteData.send()">
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.controls.*;
import mx.events.ListEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
[Bindable] private var fullXML:XMLList;
private function contentHandler(evt:ResultEvent):void{
fullXML = evt.result.values;
]]>
</mx:Script>
<mx:VBox>
<mx:Label text="This Data Grid is loading the full XML file"/>
<mx:DataGrid width="600" id="datagrid" dataProvider="{fullXML}">
<mx:columns>
<mx:DataGridColumn headerText="Select">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center">
<mx:CheckBox id="check"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="release_version" headerText="Release"/>
<mx:DataGridColumn dataField="build" headerText="build"/>
<mx:DataGridColumn dataField="time_login" headerText="time_login"/>
<mx:DataGridColumn dataField="time_tunnel" headerText="time_tunnel"/>
<mx:DataGridColumn dataField="rate_login" headerText="time_tunnel"/>
<mx:DataGridColumn dataField="rate_tunnel" headerText="rate_tunnel"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
<mx:HTTPService url="http://localhost/php_genxml.php" id="siteData" result="contentHandler(event)" resultFormat="e4x"/>
</mx:Application>
as you can see in the image , i will get this datgrid . now i want to select two or three checkboxes and would like to get all the values form the perticular row (for which check box is selected). i would like to get in array from such that i can driectly pass them to bar chart....
can some one help me in this. as i m new to flex. or if you have some other suggestion ...My final requirement is: select some values and generate bar gharph for those values.
please help me in this.
thanks
tanujHi Timo -
Thanks for the suggestion. I could get the values as below:
public void multiOpUnitValChange(ValueChangeEvent valueChangeEvent) {
// Add event code here...
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding opUnitIter = (DCIteratorBinding)bindings.get("OperatingUnit2VOIterator");
Integer[] values = (Integer[])valueChangeEvent.getNewValue();
for (int i=0; i<values.length; i++){
Row row = opUnitIter.getRowAtRangeIndex(i);
System.out.println(row.getAttribute("OpUnitId"));
Thanks -
Rohit -
Problem with checkbox item renderer in datagrid
I have a data grid having check box as an item renderer. I have viewed many posts in this forum but nothing useful in my case. I am failed to bind my datagrid itemrenderer checkbox with the field of dataprovider i.e. listUnitMovement.CHECK_PATH. Then I have to traverse data provider to check which checkboxes are checked.
[Bindable]
var listUnitMovement:XMLList=null;
In a function call
public function init(event:ResultEvent):void
listUnitMovement=event.result.unitmovement;
<mx:DataGrid id="dg_country"
dataProvider="{listUnitMovement}"
enabled="true">
<mx:columns>
<mx:DataGridColumn>
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selectedField="CHECK_PATH" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Latitude" dataField="NEW_LAT" visible="false"/>
<mx:DataGridColumn headerText="Longitude" dataField="NEW_LONG" visible="false"/>
<mx:DataGridColumn>
<mx:itemRenderer>
<mx:Component>
<mx:Button label="Details"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>Hi,
Do you want to just check/uncheck the checkboxes based on the CHECK_PATH field.
Do you want something like this...
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;[
Bindable]
private var listUnitMovement:ArrayCollection = new ArrayCollection([{CHECK_PATH:true,NEW_LAT:109.233,NEW_LONG:232.22},{CHECK_PATH:true,NEW_LAT:109.233,NEW_LONG:232.22},{CHECK_PATH:false,NEW_LAT:133.233,NEW_LONG:702.22}]);]]>
</mx:Script>
<mx:DataGrid dataProvider="{listUnitMovement}">
<mx:columns>
<mx:DataGridColumn>
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selectedField="CHECK_PATH" change="data.CHECK_PATH=selected" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="NEW_LAT"/>
<mx:DataGridColumn dataField="NEW_LONG"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
Please let me know clearly what's your problem...Do you want to just bind the check box based on XmlList or something else..?
Thanks,
Bhasker Chari.S -
Hello, I am very new to flex and don't have a programming background. I am trying to create an air app with flex that looks at a folder on the users desktop where csv files will be dropped by the user. In the air app the user will be able to browse and look for a specific csv file in a list container, once selected the information from that file should be displayed in a datagrid bellow. Finally i will be using Alive PDF to create a pdf from the information in this datagrid laid out in an invoice format. Bellow is the source code for my app as a visual refference, it only has the containers with no working code. I have also attached a sample csv file so you can see what i am working with. Can this be done? How do i do this? Please help.
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="794" height="666">
<mx:Label x="280" y="19" text="1. Select Purchase Order"/>
<mx:List y="45" width="232" horizontalCenter="0"></mx:List>
<mx:Label x="158" y="242" text="2. Verify Information"/>
<mx:DataGrid y="268" height="297" horizontalCenter="0" width="476">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
<mx:DataGridColumn headerText="Column 2" dataField="col2"/>
<mx:DataGridColumn headerText="Column 3" dataField="col3"/>
</mx:columns>
</mx:DataGrid>
<mx:Label x="355" y="606" text="3. Generated PDF"/>
<mx:Button label="Click Here" horizontalCenter="0" verticalCenter="311"/>
</mx:WindowedApplication>Open the file, parse it, populate an ArrayCollection or XMLListCollection, and make the collection the DataGrid dataProvider:
http://livedocs.adobe.com/flex/3/html/help.html?content=Filesystem_08.html
http://livedocs.adobe.com/flex/3/html/help.html?content=12_Using_Regular_Expressions_01.ht ml
http://livedocs.adobe.com/flex/3/html/help.html?content=dpcontrols_6.html
http://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.html
http://livedocs.adobe.com/flex/3/langref/mx/collections/XMLListCollection.html
If this post answered your question or helped, please mark it as such. -
Drag and Drop in DataGrid/Advanced DataGrid
Hi All,
Here is the scenario, assume that i have some 10 records in
DataGrid/Advanced DataGrid .I have selected 4th record and when i
try to drag the selected item to
down, i should be able to drag all the records one step down
from the selected record( from 4 th record to 10th record)
i.e, re-arranging the items
If i drag the selected item(assume that some 6th record) to
top, say to 2nd row then from the second row all the rows
has to come down.
And How do we
add the rows at middle and at the specified position?
Any help will be appricated and Thanks in Advance.Hi All,
myself got the solution for re-arranging the datagrid items
by using the pre-defined properties of DataGrid.
I can also get the index number of Items while start dragging
but the problem is how do i get the index number where the Items
dropped.
Here is the code..............
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="horizontal">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
private var datagridData:ArrayCollection = new
ArrayCollection([
{task:"testing drag and
drop",category:"Office",priority:"Medium"},
{task:"testing datagrid
DND",category:"personal",priority:"High"},
{task:"testing services for
todo",category:"office",priority:"Medium"},
{task:"meet ravi on
sunday",category:"personal",priority:"Low"},
{task:"buy a book",category:"friends",priority:"Medium"},
{task:"play cricket",category:"friends",priority:"Low"}]);
private function onDragStart():void
Alert.show("selected Indices"+dataGrid.selectedIndices);
private function onDragComplete():void
Alert.show("selected Indices"+dataGrid.selectedIndices);
]]>
</mx:Script>
<mx:DataGrid id="dataGrid" dataProvider="{datagridData}"
dragEnabled="true" dragMoveEnabled="true"
dropEnabled="true" allowDragSelection="true"
allowMultipleSelection="true" rowCount="10"
dragStart="onDragStart()"
dragComplete="onDragComplete()">
<!--dragStart="onDragStart()"-->
<mx:columns>
<mx:DataGridColumn dataField="task" headerText="Task"
width="200"/>
<mx:DataGridColumn dataField="category"
headerText="Category"/>
<mx:DataGridColumn dataField="priority"
headerText="Priority"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
Maybe you are looking for
-
How can I convert CMYK PDF file to Spot Color from a standard Spot Library?
Hi, I have PDF file that is in CMYK colors. Can I use Adobe Pro X to convert the document to Spot Color from a established spot library like the PANTONE PC? Is there a plugin to do it? Amit.
-
Do Not Disconnect and Being Used by Another Program
My iPod was connected to my laptop when I started it up. It launched itunes and itunes synced and said, "It's ok to disconnect." However my iPod still flashes Do Not Disconnect. So then I tried the little eject button. That gave me the message, "Cann
-
Extracting x,y co-ordinates of SDO_GEOMETRY into two variables say x1, ya
Hi All, I am able to store the output SDO_GEOMETRY into a variable but i am facing difficulties in extracting ordinates in sdo_geometry to two independent variables say xa, ya. Kindly suggest some solution. The procedure is as follows: CREATE OR REPL
-
What's the unit label of y-axis of PSD when using Spectral Measurement Express VI?
Hi: What's the unit label of y-axis of PSD when using Spectral Measurement Express VI? Selected Measurement : Power spectral density Result : dB No Averaging.. Is dB/Hz the magnitude label of PSD output? Thx!
-
Unable to Collect "exclusive beneft"
Hello everyone, I'll get straight to the point. Inside of photoshop under HELP, whenever I click on complete/update adobe id.... it takes me to a page proclaiming that if I complete my a already complete adobe id I will recieve an exclusive benefit,