Data Grid wilth Multiple ArrayCollections
I am using an array collection to store a month name and a
list of the monthly sales for a list of people, which are in their
own array collection. Adding an item to the array collection looks
something like this:
myCollection.add({month:"January",salesArray:someArrayCollection});
Where someArrayCollection has the January sales for a number
of people. The point of setting it up this way is that the size of
the embedded array collection (the number of people to display)
changes depending on what geography the user selected. Simply
binding this to a data grid leaves me with two columns, one listing
the months, and the other listing all the people's sales for that
month separated by commas within the grid tile. How can I break
these out into separate columns?
I know that you can list out the DataGridColumns within a
DataGrid and specify which field the column refers to. I'm trying
to find a way to set the dataField attribute to a particular item
within the embedded array. I would think that the code would be:
dataField="salesArray.getItemAt(0)"
to return the first person's sales in it's own column, but
this doesn't work. Any advice would be greatly appreciated.
Hi GWD and thanks for responding.
I fully understood your explanations and the example you
provided.
I'll give it a try, for sure.
But I want to know:
- How do I populate a DataGrid Component? Like a List
Component? (you said they are quite the same, I assume methods to
apply are identical...)
-In the same way, I can pull out the data from a DataGrid as
I do for the List, right?
Thanks again!
Best,
gerry
Similar Messages
-
Advanced Data Grid datasource Arraycollection addItem extremly slow
Hello everyone,
i want to add 2000 items to my existing arraycollection, which is the datasource for the Advanced Data Grid i made.
here is the code:
for(var i:int;i<res.length;i++) {
var swap:myDataGridObject = incomingdataarray[i];
datasourcearray.addItemAt(swap,i);
it takes about 2 minutes .... thats very slow, thinking of one is waiting 2 minutes every time he expanded a node in the tree.
as a solution i tryied to do it like this:
datasourcearray = new ArrayCollection( ObjectUtil.copy( incomingdataarray.source ) as Array );
the result is that it is actually working, but i can not expand my treenodes any longer. there seemed to be no items in there.
adatagrid.valdiatednow() also has no effect.
perhaps anybody came across the same thing an can help me out
thanks
steffHi,
first, thank u for your fast answer. I try to add Items to a ArrayCollection which is the dataprovider from my ADG.
i did this in this way:
for(var i:int;i<incomingDataArray.length;i++) {
var swap:myObject = incomingDataArray[i];
datasourceAC.addItemAt(swap,i);
i get the data from another method in form of a array collection, which contains many of the myObjects Elements.
The datasourceAC is the provider as mentioned above. the only way it works for me to add the items to the dataSourceAC and the ADG beeing updated in the
correct way is this one. but its very slow....
now i tried your hint like this:
var sourceArray:Array = datasourceAC.source;
for(var i:int;i<incomingDataArray.length;i++) {
var swap:myObject = incomingDataArray[i];
sourceArray.push(swap);
datasourceAC.refresh();
the result is that the nodes are loaded an displayed but i can not expand them any longer. they seemed to be empty.
as i traced that problem a little closer i realized that my groupingfunction isnt called either.... i dont know wh y;(
hope that explains everything
thanks for help
steffan -
Using drag/drop to build data grid rows from multiple lists ?
Hi,
I have implemented some simple drag and drop between grids and lists, including images.
What I need to do now is quite a bit more complex:
Create rows in a data grid by dragging and dropping from multiple lists. That is, for a given
row, column 1 receives data from list A and rows in column 2 - 5 receive data from List B
I haven't found any examples that do this and my initial hacks haven't been successful.
If you have any suggestions, they would be most appreciated !!!
Thanks !This does the trick...
For my destination grid
protected function dg_dragDropHandler(e:DragEvent):void
// Dynamically add columns to the grid by dragging them from the new column list
if (e.dragInitiator["id"] == "lNewColumn")
e.preventDefault(); // handle this manually
var Id:Number;
var Name:String;
var numCols:int = e.dragInitiator["selectedItems"]["length"] as int;
for (var i:int=0; i < numCols; i++)
Id = e.dragInitiator["selectedItems"][i]["id"];
Name = e.dragInitiator["selectedItems"][i]["Name"];
addGridColumn(Id, Name);
private function addGridColumn( Id:Number, Name:String ):void
var dgc:DataGridColumn;
var cols:Array = dg.columns;
// not a duplicate column
dgc = new DataGridColumn(Name);
dgc.width=150;
dgc.headerWordWrap = true;
dgc.itemRenderer=new ClassFactory(MyLovelyItemRenderer); // unlike mxml, must explicitly cast
dgc.width=156;
dgc.headerText = Name + "\n Message";
dgc.dataField="messageId_" + Id.toString(); // allows split on '_' later to get Id
dgc.setStyle("textAlign","center");
cols.push(dgc);
dg.columns = cols; -
Advice on rendering multiple data grids based on 1 array
What is the best way to render the following screen ?
There is 1 array collection that is sorted (in this example) by category. The screen lists by category and then prints a datagrid (perhaps) of the items within the category. Each time the category changes, a new header and data grid is rendered.
Hot Dogs (Category Description... the could be n number of categories)
Item Product Brand Grade Price
1 mini hot dogs mayer supreme 8.00
(there could be n number of lines)
Beef
Item Product Brand Grade Price
1 mini beef mayer supreme 8.00
(there could be n number of lines)Use XML data and then you can use e4x syntax to extract the data you need by filtering by category in e4x syntax.
See these LiveDocs links:
http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_03.html
http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_01.html -
Hi there,
I am a beginner in Visual Basic Express 2010. I have a Point of Sale program that uses DataGridView to display records from an external microsoft access
database using the fillby query.
It works, but it repopulates the same row each time, but i want to be able to display multiple records at the same time, a new row should be filled for
each click of the fillby button.
also I want to be able to delete any records if the customer suddenly decides to not buy an item after it has already been entered.
so actually 2 questions here:
1. how to populate a new row for each click of the fillby button
2. how to delete records from data grid view after an item has been entered
Thanks
VishwasHello,
The FillBy method loads data according to what the results are from the SELECT statement, so if there is one row then you get one row in the DataGridView, have two rows then two rows show up.
Some examples
Form load populates our dataset with all data as it was defined with a plain SELECT statement. Button1 loads via a query I created after the fact to filter on a column, the next button adds a new row to the existing data. When adding a new row it is appended
to the current data displayed and the primary key is a negative value but the new key is shown after pressing the save button on the BindingNavigator or there are other ways to get the new key by manually adding the row to the backend table bypassing the Adapter.
The following article with code shows this but does not address adapters.
Conceptually speaking the code in the second code block shows how to get the new key
Public Class Form1
Private Sub StudentsBindingNavigatorSaveItem_Click(
sender As Object, e As EventArgs) Handles StudentsBindingNavigatorSaveItem.Click
Me.Validate()
Me.StudentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MyDataSet.Students' table. You can move, or remove it, as needed.
Me.StudentsTableAdapter.Fill(Me.MyDataSet.Students)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.StudentsTableAdapter.FillBy(Me.MyDataSet.Students, ComboBox1.Text)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.MyDataSet.Students.AddStudentsRow("Jane", "Adams", "Female")
End Sub
End Class
Get new key taken from
this article.
Public Function AddNewRow(ByVal sender As Customer, ByRef Identfier As Integer) As Boolean
Dim Success As Boolean = True
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText = InsertStatement
cmd.Parameters.AddWithValue("@CompanyName", sender.CompanyName)
cmd.Parameters.AddWithValue("@ContactName", sender.ContactName)
cmd.Parameters.AddWithValue("@ContactTitle", sender.ContactTitle)
cn.Open()
cmd.ExecuteNonQuery()
cmd.CommandText = "Select @@Identity"
Identfier = CInt(cmd.ExecuteScalar)
End Using
End Using
Catch ex As Exception
Success = False
End Try
Return Success
End Function
In closing I have not given you a solution but hopefully given you some stuff/logic to assist with this issue, if not perhaps I missed what you want conceptually speaking.
Additional resources
http://msdn.microsoft.com/en-us/library/fxsa23t6.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
Data Grid Display child Class data
Hi,
I have 2 Action Script class binded to remote java class
Class 1
package hmil.setup.model
import hmil.com.general.model.Employee;
[Bindable]
[RemoteClass(alias="hmil.setup.model.Area")]
public class Area
public function Area()
public var ARMST_AREA_ID:int;
public var ARMST_CMPN_NO:String;
public var ARMST_CORP_NO:String;
public var ARMST_SCTN_TYPE:String;
public var ARMST_CRTE_USR_NO:String;
public var ARMST_CRTE_TIME:Date;
public var ARMST_UPDT_USR_NO:String
public var ARMST_UPDT_TIME:Date;
public var ARMST_DLR_LIST:ArrayCollection;
public var ARMST_EMP:Employee;
Class 2
package hmil.com.general.model
[Bindable]
[RemoteClass(alias="hmil.com.general.model.Employee")]
public class Employee
public function Employee()
public var EPMST_ID:Number;
public var EPMST_CMPN_NO:String;
public var EPMST_CORP_NO:String;
public var EPMST_EMP_NO:String;
public var EPMST_DLR_NO:String;
public var EPMST_EMP_NAME:String;
When the remote java method returns a list of Area object through Blaze DS this list can be assiged as data to the Data Grid
The DataGridColumn dataField can be mapped to the column name and it displays properly
<mx:DataGridColumn dataField="ARMST_AREA_ID" headerText="Id"/>
But lets say I wanted to display the child value (ARMST_EMP.EPMST_ID ) in the Data Grid
Since the sever returns the Parent Java Object which contains the related Employee as inner Object.
The Objetcs are deserialized to AS class objects.
But how to display the child columns in data grid.
If i give the data field as ARMST_EMP it is displayed as Object. but if i mention the datafield as ARMST_EMP.EPMST_ID, it does not display anything.
please let me know how to display the child object in datagrid
ThanksHi Mugunda, did you ever find out how to do this?
-
Update one row at a time, Data Grid
Is it possible to update one row of a mx:DataGrid at a time. I want to be able to have a user push a button and info populates one row of the data grid, user changes some properties and pushes the button again and another row of values populate the DataGrid. Everything I see does a mass population from an XML or what have you.
ThanksI did this this to work, so for those of you who may find this info helpfull here is how I solved the issue.
I instantiated an ArrayCollection object like so:
private var _rowValues:ArrayCollection = new ArrayCollection();
I simply referenced the .addItem() property of my ArrayCollection.
I then added values to the ArrayCollection as follows
_rowValues.addItem({Ingredient:ingredient, Amount:amount, Category:category}); //dataField:value
and referenced the dataField proerpty of the DataGrid... so in my case my 3 dataField properties (in my mxml compontent) were as fillows:
dataField="Ingredient"
dataField="Amount"
dataField="Category"
all done, and it works. -
My custom Tool tip on spark data Grid don't work ?
I want to add panel component as my tooltip for each row in my Spark DataGrid. So when mouse rollover the user can see the information for each the ship. I want a panel as my tooltip for dataGrid cause I want to organize my data neatly and also place a image in the panel.
I came across :http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf60d65-7ff6.html where they show an example of "Implementing the IToolTip interface" using the panel.I tried manipulating the codes but it didt work for my spark dataGrid.
So my question :
Can some one pls show me how I can use the Panel as my tool tip for each row in spark data grid.
I have been struggling for quite some time.If possible pls Give me an example.
This is my codes below (I tried to follow the example from :http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf60d65-7ff6.html#WS2d b454920e96a9e51e63e3d11c0bf60d65-7ff4 -"Implementing the IToolTip interface")
My MXML Application codes :
<fx:Script>
<![CDATA[
import DesignItemRenderer.PanelToolTip;
import mx.events.ToolTipEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import spark.events.GridEvent;
[Bindable]
private var myArrivalShips:ArrayCollection = new ArrayCollection([
{arrivalShipsName:"Ship A", ETD:"12 March"},
{arrivalShipsName:"Ship B", ETD:"25 March"}
private function createCustomTip(event:ToolTipEvent):void {
var ptt:PanelToolTip = new PanelToolTip();
ptt.title = "my Ship Info";
ptt.bodyText = "my data for the ship";
event.toolTip = ptt;
]]>
</fx:Script>
<s:BorderContainer x="267" y="11" width="331" height="586">
<s:DataGrid id="arrivalTable" x="10" y="326" width="302" height="205" requestedRowCount="4" dataProvider="{myArrivalShips}" toolTipCreate="createCustomTip(event)">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="arrivalShipsName" headerText="Arrival Ships" ></s:GridColumn>
<s:GridColumn dataField="ETD" headerText="ETD"></s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
<s:BorderContainer x="10" y="19" width="302" height="285">
</s:BorderContainer>
</s:BorderContainer>
My Custom Panel codes :
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
implements="mx.core.IToolTip" >
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
[Bindable]
public var bodyText:String = "";
// Implement required methods of the IToolTip interface; these
// methods are not used in this example, though.
public var _text:String;
public function get text():String {
return _text;
public function set text(value:String):void {
]]>
</fx:Script>
<s:RichText text="{bodyText}" percentWidth="100"/>
</s:Panel>Ok I was getting ready to post the renderer code and then found the problem. I had copied this code from another renderer which had contentBackgroundAlpha=0 in the MXAdvancedDataGridItemRenderer tag. When I removed it, the style of the TextArea worked as intended. Your comment helped me to take a closer look at the renderer code, so thank you.
-
Flex mobile app - which data grid control to use?
Hi,
Trying to build my first Flex mobile app in FlashBuilder 4.6 and I need a grid control to display a 2 dimmensional array of 6 columns x 50 rows.
The user doesn't don't need to have any interraction with the grid except for scrolling the rows.
I was looking at using dataGrid component but adobe doesn't recommend it for mobile apps.
Is there a grid component that is recommended for mobile apps?
ThanksHere it is.
// Show empty grid to start
private function initGrid():void
const dataArray:Array = new Array(1);
var values:Array = new Array(1);
values[0] = "";
dataArray[0] = values;
grid.dataProvider = new ArrayCollection(dataArray);
// Build array and feed it to the grid - 50 rows x 9 columns dataGrid (grid)
protected function FillGrid():void
var rows:int = 50;
var columns:int = 9;
// rows array
const dataArray:Array = new Array(rows);
// Get rows
for(var row:int=0; row<rows; row++)
const arrLine:Array = [columns+1];
arrLine[0] = row+1;
for(var col:int=1; col<columns+1; col++)
// columns array
arrLine[col] = Math.floor(Math.random()*10);
dataArray[row] = arrLine;
// At this point the multi dimensional array is assembled, now we connect it to the dataGrid
grid.dataProvider = new ArrayCollection(dataArray);
<!-- The DataGrid's dataProvider and typicalItem are set at initialize time by the initializeDataProvider method. -->
<s:Panel id="tablePanel" x="519" top="91" width="470" height="400" color="#827259" fontSize="18" title=".">
<s:DataGrid id="grid" left="5" right="5" top="5" bottom="5" selectionMode="singleRow" initialize="initGrid()" fontSize="17" >
<!-- The default item renderer is used by the first 6 columns to display
the dataProvider item's array element value at col. -->
<s:itemRenderer>
<fx:Component>
<s:DefaultGridItemRenderer>
<fx:Script>
<![CDATA[
override public function prepare(hasBeenRecycled:Boolean):void
label = data[columnIndex];
]]>
</fx:Script>
</s:DefaultGridItemRenderer>
</fx:Component>
</s:itemRenderer>
<s:columns>
<s:ArrayList>
<!-- Columns inherit the DataGrid's itemRenderer. -->
<s:GridColumn id="zero" headerText="N0" width="65" resizable="false"/>
<s:GridColumn id="one" headerText="N1" width="45" resizable="false"/>
<s:GridColumn id="two" headerText="N2" width="45" resizable="false"/>
<s:GridColumn id="three" headerText="N3" width="45" resizable="false"/>
<s:GridColumn id="four" headerText="N4" width="45" resizable="false"/>
<s:GridColumn id="five" headerText="N5" width="45" resizable="false"/>
<s:GridColumn id="six" headerText="N6" width="45" resizable="false"/>
<s:GridColumn id="seven" headerText="N7" width="45" resizable="false"/>
<s:GridColumn id="eight" headerText="N8" width="65" resizable="false"/>
</s:ArrayList>
</s:columns>
</s:DataGrid>
</s:Panel>
Tomexxus -
Data Grid in a List Component???
Hi there!
I have a populated List Component set to Multiple Selection.
This list contains titles of a magazine issues.
I wish to allow the user to select one or more items in the
list and enter the quantity of the selected issue(s) he/she wants
to receive.
Is it possible to achieve this with a Data GRid integrated in
the List Component or which simplier solution must I contemplate?
I thank you in advance for indicating the best way to
explore.
Best regards,
GerryHi GWD and thanks for responding.
I fully understood your explanations and the example you
provided.
I'll give it a try, for sure.
But I want to know:
- How do I populate a DataGrid Component? Like a List
Component? (you said they are quite the same, I assume methods to
apply are identical...)
-In the same way, I can pull out the data from a DataGrid as
I do for the List, right?
Thanks again!
Best,
gerry -
I am using windows and the latest build of SQL Developer. Click on a Table name > Data tab to see the data grid representing data in the table. OR....run any SQL returning a result set. Either case, select a cell. CTRL + C now works as expected, good. But the copy operation copies a TAB too for somereason. A real pain when I paste into a manual SQL block or something.
Also, any way we can change the data grid when browsing a tables data to require a double-click to edit a cell? This would be a Good Thing(tm)
DKThe tab in the copy is good IF you are selecting multiple cells - if you only select a single cell, it is a painAgree completely, copying a single cell should have no additional characters at all.
Also agree on the double click, although I would like something similar to TOAD whereby to edit a cell that already has focus only requires a single click. I like to move the selected field around using the cursor keys (I find this quicker) and then hitting either Enter or single clicking or just start typing to begin editing. Double click would still work (for those who like to double click). -
Really Urgent: List with Data Grid rowcount issue i added the full code below
Thanks in advance
Exactly wat i need is
1.if i click the open button want to visible all datagrid ,its working perfectly.
2.if i click the close button want to close all data grid ,its working perfectly.
3. if i click a particular list means want to visible particular datagrid..some times working good but some times not visible ...
4.if i click the list if datagrid already open means want to close .some times creates extra space below the datagrid........
if u cont get clearly please copy the below code and check it.....i think there is row count not working properly...any other way to solve this problem?.......
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" >
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var ArrUserList:ArrayCollection;
[Bindable]
public var listDB:ArrayCollection = new ArrayCollection([ {label: "2011", data:"jan",day:"saturday",date:"1-4-11"},
{label: "2011", data:"jan",day:"monday",date:"13-4-11"}, {label: "2013", data:"jan",day:"monday",date:"1-5-11"}, {label: "2013", data:"jan",day:"wednesday",date:"14-5-11"}, {label: "2015", data:"jan",day:"tuesday",date:"11-5-11"}, {label: "2015" ,data:"jan",day:"friday",date:"1-6-11"} ]);
public var loc_first_last_name:String;
function Load():void
ArrUserList=Find_Duplicate(listDB);
for(var i:int=0; i<ArrUserList.length; i++)
ArrUserList[i].click=0;
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount=ArrUserList.length;
function Clink_lnk_open():void
if(lnk_open.label=="Open")
for(var i:int=0; i<ArrUserList.length; i++)
ArrUserList[i].click=1;
lnk_open.label="Close";
ArrUserList.refresh();
Lst_userlist.validateNow();
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount = ArrUserList.length ;
else
for(var i:int=0; i<ArrUserList.length; i++)
ArrUserList[i].click=0;
lnk_open.label="Open";
ArrUserList.refresh();
Lst_userlist.validateNow();
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount = ArrUserList.length ;
function Click_UserName1(event:MouseEvent,data:Object):void
loc_first_last_name=event.currentTarget.text;
var str:String;
for(var i:int=0; i<ArrUserList.length; i++)
str=ArrUserList[i].label;
if(loc_first_last_name==str)
if(ArrUserList[i].click == 0)
ArrUserList[i].click=1;
else
ArrUserList[i].click=0;
ArrUserList.refresh();
Lst_userlist.validateNow();
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount=ArrUserList.length;
public function Find_Duplicate(test_arr:ArrayCollection):ArrayCollection
var res_arr:ArrayCollection=new ArrayCollection();
var flag:Boolean;
for(var i:int=0;i<test_arr.length;i++)
var j:int=0
flag=false;
for(;j<res_arr.length;j++)
if(res_arr[j].label==test_arr[i].label)
res_arr[j].dataCollection.addItem(test_arr[i]);
flag=true;
break;
if(!flag)
var myItem:Object = new Object() ;
myItem.label=test_arr[i].label;
myItem.dataCollection=new ArrayCollection();
myItem.dataCollection.addItem(test_arr[i]);
res_arr.addItem(myItem) ;
return res_arr;
]]>
</fx:Script>
<s:Scroller id="id_scroller" width="100%" height="100%">
<s:VGroup id="id_Vgroup" paddingLeft="50" paddingTop="10" paddingBottom="10" width="100%" height="100%" >
<mx:VBox width="850" paddingLeft="0" paddingTop="1" color="black" backgroundColor="#FFFFFF">
<mx:HBox width="850" left="50" paddingBottom="3" paddingLeft="5" backgroundColor="#6D6C6C" paddingTop="3" color="#FFFFFF" >
<mx:LinkButton id="lnk_open" label="Open" textDecoration="underline" click="Clink_lnk_open();"/>
<mx:Button id="load_btn" label="Load" click="Load()"/>
</mx:HBox>
<mx:VBox id="Vbox_main" width="850" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:List variableRowHeight="true" width="850" id="Lst_userlist" paddingTop="-3" verticalScrollPolicy="off" horizontalScrollPolicy="off"
buttonMode="true" >
<mx:itemRenderer>
<fx:Component>
<mx:VBox paddingTop="-5" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
override public function set data(value:Object):void
super.data = value;
Membership_Grid.dataProvider=data.dataCollection;
Membership_Grid.rowCount=data.dataCollection.length;
lbl_userhead.text=data.label;
lbl_userhead1.text=data.dataCollection.length+" Datas";
if(data.click==1)
Vbox_main.visible=true;
Vbox_main.includeInLayout=true;
else
Vbox_main.visible=false;
Vbox_main.includeInLayout=false;
Membership_Grid.validateNow() ;
]]>
</fx:Script>
<mx:HBox id="vbox_grid" horizontalScrollPolicy="off" height="25" verticalScrollPolicy="off" width="850" paddingLeft="10" paddingTop="5" backgroundColor="#6D6C6C" color="#FFFFFF">
<s:Label id="lbl_userhead" click="outerDocument.Click_UserName1(event,data)" buttonMode="true" width="250" paddingTop="3" />
<s:Label id="lbl_userhead1" buttonMode="true" width="548" paddingTop="3" />
</mx:HBox>
<mx:VBox id="Vbox_main" width="850" horizontalScrollPolicy="off" verticalScrollPolicy="off" visible="false" includeInLayout="false" >
<mx:DataGrid id="Membership_Grid" alternatingItemColors="[#DCDCDC,#F8F8FF]" paddingLeft="5" horizontalScrollPolicy="off" color="black"
horizontalGridLines="false" verticalScrollPolicy="auto" verticalGridLines="false" rowHeight="25" width="850" borderSkin="{null}"
borderVisible="false" >
<mx:columns>
<mx:DataGridColumn width="150" headerText="Year" dataField="label"/>
<mx:DataGridColumn width="150" headerText="Month" dataField="data"/>
<mx:DataGridColumn width="150" headerText="Day" dataField="day" />
<mx:DataGridColumn width="150" headerText="Date" dataField="date"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:VBox>
</fx:Component>
</mx:itemRenderer>
</mx:List>
</mx:VBox>
</mx:VBox>
</s:VGroup>
</s:Scroller>
</s:Group>Hi,
You already wrote the same exact post 4 times! Don't you think it's enough?
May 12 : http://forums.adobe.com/message/3672269#3672269
May 20 : http://forums.adobe.com/message/3690500#3690500
May 23 : http://forums.adobe.com/message/3696874#3696874
May 25 : http://forums.adobe.com/message/3701649#3701649
If you want someone help you, from my point of view it surely not the right way of doing, especially by writing Really Urgent. It just annoys people (and btw it seems not to be so urgent as you stay with it since the May12). If you want a "urgent" answer, hire a Flex expert or just be patient.
Kind regards,
Mich -
Thanks in advance
Exactly wat i need is
1.if i click the open button want to visible all datagrid ,its working perfectly.
2.if i click the close button want to close all data grid ,its working perfectly.
3. if i click a particular list means want to visible particular datagrid..some times working good but some times not visible ...
4.if i click the list if datagrid already open means want to close .some times creates extra space below the datagrid........
if u cont get clearly please copy the below code and check it.......any other way to solve this problem?.......
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" >
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var ArrUserList:ArrayCollection;
[Bindable]
public var listDB:ArrayCollection = new ArrayCollection([ {label: "2011", data:"jan",day:"saturday",date:"1-4-11"},
{label: "2011", data:"jan",day:"monday",date:"13-4-11"}, {label: "2013", data:"jan",day:"monday",date:"1-5-11"}, {label: "2013", data:"jan",day:"wednesday",date:"14-5-11"}, {label: "2015", data:"jan",day:"tuesday",date:"11-5-11"}, {label: "2015" ,data:"jan",day:"friday",date:"1-6-11"} ]);
public var loc_first_last_name:String;
function Load():void
ArrUserList=Find_Duplicate(listDB);
for(var i:int=0; i<ArrUserList.length; i++)
ArrUserList[i].click=0;
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount=ArrUserList.length;
function Clink_lnk_open():void
if(lnk_open.label=="Open")
for(var i:int=0; i<ArrUserList.length; i++)
ArrUserList[i].click=1;
lnk_open.label="Close";
ArrUserList.refresh();
Lst_userlist.validateNow();
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount = ArrUserList.length ;
else
for(var i:int=0; i<ArrUserList.length; i++)
ArrUserList[i].click=0;
lnk_open.label="Open";
ArrUserList.refresh();
Lst_userlist.validateNow();
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount = ArrUserList.length ;
function Click_UserName1(event:MouseEvent,data:Object):void
loc_first_last_name=event.currentTarget.text;
var str:String;
for(var i:int=0; i<ArrUserList.length; i++)
str=ArrUserList[i].label;
if(loc_first_last_name==str)
if(ArrUserList[i].click == 0)
ArrUserList[i].click=1;
else
ArrUserList[i].click=0;
ArrUserList.refresh();
Lst_userlist.validateNow();
Lst_userlist.dataProvider=ArrUserList;
Lst_userlist.rowCount=ArrUserList.length;
public function Find_Duplicate(test_arr:ArrayCollection):ArrayCollection
var res_arr:ArrayCollection=new ArrayCollection();
var flag:Boolean;
for(var i:int=0;i<test_arr.length;i++)
var j:int=0
flag=false;
for(;j<res_arr.length;j++)
if(res_arr[j].label==test_arr[i].label)
res_arr[j].dataCollection.addItem(test_arr[i]);
flag=true;
break;
if(!flag)
var myItem:Object = new Object() ;
myItem.label=test_arr[i].label;
myItem.dataCollection=new ArrayCollection();
myItem.dataCollection.addItem(test_arr[i]);
res_arr.addItem(myItem) ;
return res_arr;
]]>
</fx:Script>
<s:Scroller id="id_scroller" width="100%" height="100%">
<s:VGroup id="id_Vgroup" paddingLeft="50" paddingTop="10" paddingBottom="10" width="100%" height="100%" >
<mx:VBox width="850" paddingLeft="0" paddingTop="1" color="black" backgroundColor="#FFFFFF">
<mx:HBox width="850" left="50" paddingBottom="3" paddingLeft="5" backgroundColor="#6D6C6C" paddingTop="3" color="#FFFFFF" >
<mx:LinkButton id="lnk_open" label="Open" textDecoration="underline" click="Clink_lnk_open();"/>
<mx:Button id="load_btn" label="Load" click="Load()"/>
</mx:HBox>
<mx:VBox id="Vbox_main" width="850" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:List variableRowHeight="true" width="850" id="Lst_userlist" paddingTop="-3" verticalScrollPolicy="off" horizontalScrollPolicy="off"
buttonMode="true" >
<mx:itemRenderer>
<fx:Component>
<mx:VBox paddingTop="-5" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
override public function set data(value:Object):void
super.data = value;
Membership_Grid.dataProvider=data.dataCollection;
Membership_Grid.rowCount=data.dataCollection.length;
lbl_userhead.text=data.label;
lbl_userhead1.text=data.dataCollection.length+" Datas";
if(data.click==1)
Vbox_main.visible=true;
Vbox_main.includeInLayout=true;
else
Vbox_main.visible=false;
Vbox_main.includeInLayout=false;
Membership_Grid.validateNow() ;
]]>
</fx:Script>
<mx:HBox id="vbox_grid" horizontalScrollPolicy="off" height="25" verticalScrollPolicy="off" width="850" paddingLeft="10" paddingTop="5" backgroundColor="#6D6C6C" color="#FFFFFF">
<s:Label id="lbl_userhead" click="outerDocument.Click_UserName1(event,data)" buttonMode="true" width="250" paddingTop="3" />
<s:Label id="lbl_userhead1" buttonMode="true" width="548" paddingTop="3" />
</mx:HBox>
<mx:VBox id="Vbox_main" width="850" horizontalScrollPolicy="off" verticalScrollPolicy="off" visible="false" includeInLayout="false" >
<mx:DataGrid id="Membership_Grid" alternatingItemColors="[#DCDCDC,#F8F8FF]" paddingLeft="5" horizontalScrollPolicy="off" color="black"
horizontalGridLines="false" verticalScrollPolicy="auto" verticalGridLines="false" rowHeight="25" width="850" borderSkin="{null}"
borderVisible="false" >
<mx:columns>
<mx:DataGridColumn width="150" headerText="Year" dataField="label"/>
<mx:DataGridColumn width="150" headerText="Month" dataField="data"/>
<mx:DataGridColumn width="150" headerText="Day" dataField="day" />
<mx:DataGridColumn width="150" headerText="Date" dataField="date"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:VBox>
</fx:Component>
</mx:itemRenderer>
</mx:List>
</mx:VBox>
</mx:VBox>
</s:VGroup>
</s:Scroller>
</s:Group>Hi
Sir am using flex 4.0.1 SDKS 4.1.0....
Still i cont fix this problem....i have the same prob in many mxml files .any alternate solution for my prob pls let me know...
Thanks in Advance,
senthil. -
Need help with data grid...
I have setup a profile card which displays information about individuals by pulling data from an XML database.
I have multiple text fields and couple movie clips that display images but i need a datagrid to display stats for each individual.
The stat information is set as attributes on a array of XML nodes each node is a year.
Example XML
<hockey>
<profile>
<name>Wayne Gretzky</name>
<image>pic1</image>
<dob>Jan 26, 1961</dob>
<position>Centre</position>
<height>6'0"</height>
<weight>185lbs</weight>
<history>"important information"</history>
<medal_record>
<medal standing ="Silver" Event =" 1981 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Gold" Event =" 1984 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Gold" Event =" 1987 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Gold" Event =" 1991 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Silver" Event =" 1996 World Cup of Hockey" sport="Ice Hockey"/>
</medal_record>
</profile>
<profile>
<name>Wayne Gretzky2</name>
<image>pic2</image>
<dob>Jan 26, 1962</dob>
<position>Right Wing</position>
<height>6'1"</height>
<weight>205lbs</weight>
<history>"important information"</history>
<medal_record>
<medal standing ="Gold" Event =" 1981 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Bronze" Event =" 1984 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Silver" Event =" 1987 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Silver" Event =" 1991 Canada Cup" sport="Ice Hockey"/>
<medal standing ="Gold" Event =" 1996 World Cup of Hockey" sport="Ice Hockey"/>
</medal_record>
</profile>
</hockey>
The red information is what i need to get displayed by the Data Grid for each profile.
Standing
Event
Sport
Gold
1981 Canada Cup
Ice Hockey
Bronze
1984 Canada Cup
Ice Hockey
The swf has buttons to cycle through the profiles which loads the new information from the XML.
If you have a good understanding of how the dataGRIDs work please let me know if you can help as this is the last problem holding me from finishing this.
Thanks in advance.Update... I got the data pulling in but it doesnt change as the profile changes with the rest of the data.
-
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.
Maybe you are looking for
-
HT4623 Speaker doesn't work all the time
Cannot hear videos on Facebook. I need to open the link in Safari to hear it. Also, not all of my apps sounds work.
-
Finding a minimum value in an array without using loops
I can find a minimum value in an array using a loop, but I am unsure of how to do it without any type of of loop Here is what I have using a loop: // This method searches for the minimum value in an array public static int min(int a[]){ int min = a[0
-
I'm trying to write an IF statement similar to <?if:QUANTITY='0'?> but would like to say 'is greater than' 0. I'm not very familiar with the coding in XML and what characters I'm able to use since I can't use <> in the coding. Can anyone help? Thanks
-
Hi, My iphone 4 is not working since last 42 hours. yesterday morning i found my iphone4 switched off and i was trying to swtich on my ipphone 4 but i was failed. so i thought i had to put in charge. but th also itwas not charged...and yesterday nigh
-
The music will not come off of my ipod
I wanted to adjust the music on my ipod by taking some of it off and it just won't come off of my ipod.