Datagrid itemeditor issue
I have a 2 datagrids that are bound together so that if you
click on an item in the top, it shows up in the bottom. They are in
a vdivided box and the box is in a custom panel. I have a combobox
item editor in the "parent" datagrid, however when i click on it it
disappears before i can make a selection. Has anyone had similar
issues with an editor in a datagrid?
I took a look at that, it gives me an error saying there is
no default value. I'm guessing that's because i use the information
from that combobox to be entered into an array collection. If the
combobox doesnt close, i cannot access the value selected.
Anyway, I messed around with the heights and widths which i
had set at 100%. It seems to be a problem here. If I select a
static number rather than a percentage it works, but i want the
percentage so when i resize my custom panel, the grid sizes with
it.
Similar Messages
-
Hi,
I have a datagrid in my application with custom itemRenderer & itemEditor. The rendererIsEditor property is false for the column. I also have a menu bar in my application. Now if I edit any cell the itemRenderer will be replaced with itemEditor and as the focus moves out the itemEditor switches to itemRenderer. It is the default nature of datagrid.
Requirement: I am editting a cell, now if I select any menu item, then the itemEditor of the cell in which I was working should not be destroyed. As I would like to perform an operation in edit mode of that cell.
Thanks in advance.Ok Alex
I'll wait.
Thanks.
I have one more issue regarding datagrid itemEditor.
I have rendererIsEditor property of datagrid column as "false" .
In my itemEditor I have 2 extra components than itemRenderer. So I need to have some extra row height in edit mode. The height of the row which is in edit mode should only grow.
I tried with editorHeightOffset but it overlaps the next row. But I need that height of the current row in which I am should grow instead.
Can we achieve this?
If not please suggest me any alternative or work around.
Thanks. -
Revision: 14289
Revision: 14289
Author: [email protected]
Date: 2010-02-19 13:08:54 -0800 (Fri, 19 Feb 2010)
Log Message:
Fix DataGrid mirroring issues when layoutDirection="rtl" and direction="rtl":
- headers get messed up when resizing, moving or sorting a column because the transform matrix in UIFTETextField wasn?\226?\128?\153t always updated when width was changed
- when moving a column, the headerSelection sprite was moving in the wrong direction
- when dragging a row, the drag image was backwards and the x offset between the image and the mouse pointer was wrong
QE notes:
Doc notes: None
Bugs: SDK-25424, SDK-25426, SDK-25440, SDK-25442, SDK-25452, SDK-25460, SDK-25462, SDK-25464
Reviewed By: Hans
Tests run: checkintests
Is noteworthy for integration: No
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-25424
http://bugs.adobe.com/jira/browse/SDK-25426
http://bugs.adobe.com/jira/browse/SDK-25440
http://bugs.adobe.com/jira/browse/SDK-25442
http://bugs.adobe.com/jira/browse/SDK-25452
http://bugs.adobe.com/jira/browse/SDK-25460
http://bugs.adobe.com/jira/browse/SDK-25462
http://bugs.adobe.com/jira/browse/SDK-25464
Modified Paths:
flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/DataGrid.as
flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataG ridDragProxy.as
flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataG ridHeader.as
flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/core/UITextField.as
flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/managers/DragManagerImpl.as
flex/sdk/branches/4.x/frameworks/projects/spark/src/mx/core/UIFTETextField.asDear Pallavi,
Very useful post!
I am looking for similar accelerators for
Software Inventory Accelerator
Hardware Inventory Accelerator
Interfaces Inventory
Customization Assessment Accelerator
Sizing Tool
Which helps us to come up with the relevant Bill of Matetials for every area mentioned above, and the ones which I dont know...
Request help on such accelerators... Any clues?
Any reply, help is highly appreciated.
Regards
Manish Madhav -
Advanced DataGrid Performance Issue
Hi,
I used advanced data grid which have more than 40 rows and more than 25 columnand this rows minght be more according to project size .
And in this i used separated Renderer for each cell , header and rowColumn (i.e.first column)
My issue with performance of system. Because of this grid my screen draw is take time about 8/9 second that is not happen with low data or less row count..
How can i up performance of this advnced data grid ?
It's really urgent for me because now my project is in tuff situation.
Please if any one knows how can i resolve this issue and any idea about speed up advanced datagrid then please tell me.
Thanks,
Mohit.Use the performance profiler. See past discussion on renderer optimization.
-
Tab not working properly for Datagrid ItemEditor ComboBox
When you run the app type a1 in the find an App combo box then hit the tab key.
Click in the 3rd row in the As Bs column and a combobox will show.
Type a3 and then hit enter. Notice that A3 is saved as the selected item and saved to the dataprovider
Hit the backspace key and hit enter. Notice that the null is saved and nothing is selected.
Type a3 again and hit enter.
Hit the backspce again but this time hit the tab key. Notice the previous value is back. ooops.
{Code}
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:vo="valueObjects.*"
width="100%" height="100%">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
protected function aCBLabel(item:Object):String
if (item != null)
return item.name;
else
return "";
protected function bDG_creationCompleteHandler(event:FlexEvent):void
bDG.selectedIndex = 0;
protected function bAFormat(item:Object, column:DataGridColumn):String
if (item [column.dataField] != null)
return item [column.dataField].name;
else
return "";
]]>
</fx:Script>
<fx:Declarations>
<vo:ADto id="aDto"/>
<vo:BDto id="bDto"/>
<s:ArrayCollection id="aList">
<vo:ADto>
<vo:id>1</vo:id>
<vo:name>a1</vo:name>
<vo:bs>
<vo:BDto>
<vo:id>1</vo:id>
<vo:aDto>
<vo:ADto>
<vo:id>1</vo:id>
<vo:name>a1</vo:name>
</vo:ADto>
</vo:aDto>
</vo:BDto>
<vo:BDto>
<vo:id>2</vo:id>
<vo:aDto>
<vo:ADto>
<vo:id>2</vo:id>
<vo:name>a2</vo:name>
</vo:ADto>
</vo:aDto>
</vo:BDto>
<vo:BDto>
<vo:id>0</vo:id>
</vo:BDto>
</vo:bs>
</vo:ADto>
<vo:ADto>
<vo:id>2</vo:id>
<vo:name>a2</vo:name>
<vo:bs>
<vo:BDto>
<vo:id>3</vo:id>
<vo:aDto>
<vo:ADto>
<vo:id>3</vo:id>
<vo:name>a3</vo:name>
</vo:ADto>
</vo:aDto>
</vo:BDto>
<vo:BDto>
<vo:id>0</vo:id>
</vo:BDto>
</vo:bs>
</vo:ADto>
</s:ArrayCollection>
<s:ArrayCollection id="bAList">
<vo:ADto>
<vo:id>1</vo:id>
<vo:name>a1</vo:name>
</vo:ADto>
<vo:ADto>
<vo:id>2</vo:id>
<vo:name>a2</vo:name>
</vo:ADto>
<vo:ADto>
<vo:id>3</vo:id>
<vo:name>a3</vo:name>
</vo:ADto>
</s:ArrayCollection>
</fx:Declarations>
<fx:Binding source="aCB.selectedItem as ADto" destination="aDto"/>
<s:Form id="AForm" width="700" height="170">
<s:layout>
<s:BasicLayout/>
</s:layout>
<s:HGroup x="0" y="50" width="670" height="60">
<s:Label height="25" fontWeight="bold" text="Find an A" verticalAlign="middle"/>
<s:ComboBox id='aCB'
prompt="Enter or Select an A Name"
labelFunction="aCBLabel"
x="110" y="10" width="375">
<mx:ArrayCollection id="asList" list="{aList}"/>
</s:ComboBox>
</s:HGroup>
</s:Form>
<mx:DataGrid id="bDG" x="10" y="140" width="450" height="200"
editable="true"
dataProvider="{aDto.bs}"
creationComplete="bDG_creationCompleteHandler(event)">
<mx:columns>
<mx:DataGridColumn id="bidDC"
headerText="id"
editable="true"
dataField="id"
editorDataField="value"
width="50"/>
<mx:DataGridColumn id="bNameDC"
headerText="As Bs"
editable="true"
dataField="aDto"
labelFunction="bAFormat"
editorDataField="value"
width="150">
<mx:itemEditor>
<fx:Component>
<s:MXDataGridItemRenderer implements="mx.managers.IFocusManagerComponent">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.events.FlexEvent;
import spark.events.DropDownEvent;
import spark.events.IndexChangeEvent;
[Bindable]
public var bAs:ArrayCollection;
protected function cb_InitializeHandler(event:FlexEvent):void
bAs = outerDocument.bAList;
aDto = outerDocument.bDG.selectedItem.aDto;
if (aDto != null)
var t:ADto;
for (var i:int = 0; i<bAs.length; i++)
t = bAs[i];
if (aDto.id == t.id)
cb.selectedIndex = i;
break;
override public function setFocus():void
cb.setFocus();
public function get value():ADto
if (cb.isDropDownOpen)
cb.closeDropDown(true);
cb.validateNow();
aDto = cb.selectedItem as ADto;
return aDto
protected function cb_closeHandler(event:DropDownEvent):void
aDto = cb.selectedItem as ADto;
]]>
</fx:Script>
<fx:Declarations>
<vo:ADto id="aDto"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:ComboBox id="cb"
width = "100%"
prompt="{aDto.name}"
dataProvider="{bAs}"
labelField="name"
initialize="cb_InitializeHandler(event)"
close="cb_closeHandler(event)">
</s:ComboBox>
</s:MXDataGridItemRenderer>
</fx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</s:Application>
{Code}
{Code}
package valueObjects
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.valueobjects.IValueObject;
import mx.collections.ArrayCollection;
import valueObjects.BDto;
import com.adobe.fiber.core.model_internal;
use namespace model_internal;
public class ADto implements com.adobe.fiber.valueobjects.IValueObject
private var _internal_id : int;
private var _internal_name : String;
private var _internal_bs : ArrayCollection;
model_internal var _internal_bs_leaf:valueObjects.BDto;
public function ADto()
public function get id() : int
return _internal_id;
public function get name() : String
return _internal_name;
public function get bs() : ArrayCollection
return _internal_bs;
public function set id(value:int) : void
var oldValue:int = _internal_id;
if (oldValue !== value)
_internal_id = value;
public function set name(value:String) : void
var oldValue:String = _internal_name;
if (oldValue !== value)
_internal_name = value;
public function set bs(value:*) : void
var oldValue:ArrayCollection = _internal_bs;
if (oldValue !== value)
if (value is ArrayCollection)
_internal_bs = value;
else if (value is Array)
_internal_bs = new ArrayCollection(value);
else if (value == null)
_internal_bs = null;
else
throw new Error("value of bs must be a collection");
private var _managingService:com.adobe.fiber.services.IFiberManagingService;
public function set managingService(managingService:com.adobe.fiber.services.IFiberManagi ngService):void
_managingService = managingService;
{Code}
{Code}
package valueObjects
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.valueobjects.IValueObject;
import valueObjects.ADto;
import mx.collections.ArrayCollection;
use namespace model_internal;
public class BDto implements com.adobe.fiber.valueobjects.IValueObject
private var _internal_id : int;
private var _internal_aDto : ADto;
private static var emptyArray:Array = new Array();
public function BDto()
_internal_id = 0;
public function get id() : int
return _internal_id;
public function get aDto() : ADto
return _internal_aDto;
public function set id(value:int) : void
var oldValue:int = _internal_id;
if (oldValue !== value)
_internal_id = value;
public function set aDto(value:ADto) : void
var oldValue:ADto = _internal_aDto;
if (oldValue !== value)
_internal_aDto = value;
private var _managingService:com.adobe.fiber.services.IFiberManagingService;
public function set managingService(managingService:com.adobe.fiber.services.IFiberManagi ngService):void
_managingService = managingService;
{Code}the reason the tab was not working is because it was not changing the selection and just exiting the combo box. So, in the value function add if (cb.textInput.text == "") cb.selectedIndex = -1; This will change the selection as desired and fixes the problem.
-
Hi All,
I have a tab navigator with 3 canvas, in each canvas I have a datagrid displaying the same record id's with some different data. If i click in one of the datagrid row I am selecting the same index row in the other two datagrids.
My issue is when I select a row using high number with scroll. To show the same row in the other two datagrids I am using scrollToIndex but the it is not working until I select the datagrid first, after that it works fine.
I try using validateNow() like this example but no luck:
http://www.anujgakhar.com/2007/12/28/flex-how-to-pre-select-an-item-in-datagrid/
Any ideas?
Thanks
JFBHi Alex,
I did create a test with structure of my app and it works fine after setting creationPolicy all in the tab navigator.
I try the same in my main app and it is not working , I try setting creationPolicy in all tab navigators and no luck, still the same, it works after selecting the other datagrids.
How can I debug this issue?
Thanks for you reply and help.
JFB
Here is my test code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.ListEvent;
[Bindable] private var acSample2:ArrayCollection = new ArrayCollection;
private var TotalTYCOM:Number = 0;
[Bindable] private var acSample:ArrayCollection = new ArrayCollection([
{Fname: "Kranthi", Lname:"Kata", dob:"21/10/1972", Amount:10000, Rate:0},
{Fname: "Vasanth", Lname:"Lola", dob:"12/01/1980", Amount:5000, Rate:0},
{Fname: "Sample1", Lname:"Lola", dob:"12/01/1982", Amount:10000, Rate:0},
{Fname: "Basanth", Lname:"Viola", dob:"5/01/1980", Amount:5000, Rate:0},
{Fname: "Sample2", Lname:"Viola", dob:"2/06/1985", Amount:10000, Rate:0},
{Fname: "Manoj", Lname:"Pati", dob:"16/09/1978", Amount:5000, Rate:0},
{Fname: "John McClain", Lname:"Mela", dob:"15/01/1974", Amount:10000, Rate:0},
private function setADGRow(event:ListEvent):void{
var rowIndex:Number = event.rowIndex;
total_dg.selectedIndex = rowIndex;
first_dg.selectedIndex = rowIndex;
second_dg.selectedIndex = rowIndex;
total_dg.validateNow();
first_dg.validateNow();
second_dg.validateNow();
total_dg.scrollToIndex(rowIndex);
first_dg.scrollToIndex(rowIndex);
second_dg.scrollToIndex(rowIndex);
]]>
</mx:Script>
<mx:TitleWindow width="100%" height="100%" layout="absolute" title="Summary" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:TabNavigator id="firstLevel" width="100%" height="100%">
<mx:Canvas id="one" label="ONE" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
</mx:Canvas>
<mx:Canvas id="two" label="TWO" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
</mx:Canvas>
<mx:Canvas id="three" label="THREE" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:TabNavigator width="100%" height="100%">
<mx:Canvas id="AA_ONE" label="FIST" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:TabNavigator id="firstTabNav" width="100%" height="100%" creationPolicy="all" >
<mx:Canvas label="Totals" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
</mx:Canvas>
<mx:Canvas label="First" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
</mx:Canvas>
<mx:Canvas label="Second" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
</mx:Canvas>
</mx:TabNavigator>
</mx:Canvas>
<mx:Canvas id="AA_TWO" label="SECOND" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:TabNavigator id="secondTabNav" width="100%" height="100%" creationPolicy="all" >
<mx:Canvas label="Totals" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:AdvancedDataGrid id="total_dg" dataProvider="{acSample}" x="10" y="10" width="890" height="150" editable="false" itemClick="setADGRow(event)"
sortableColumns="false" headerHeight="40" lockedColumnCount="1" >
<mx:columns>
<mx:AdvancedDataGridColumn headerText="FIRST NAME" dataField="Fname" width="150" />
<mx:AdvancedDataGridColumn headerText="LAST NAME" dataField="Lname" width="150" />
<mx:AdvancedDataGridColumn headerText="DOB" dataField="dob" width="150" />
<mx:AdvancedDataGridColumn headerText="TOTAL" dataField="Amount" width="100" textAlign="right" />
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Canvas>
<mx:Canvas label="First" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:AdvancedDataGrid id="first_dg" dataProvider="{acSample}" x="10" y="10" width="890" height="150" editable="false" itemClick="setADGRow(event)"
sortableColumns="false" headerHeight="40" lockedColumnCount="1" >
<mx:columns>
<mx:AdvancedDataGridColumn headerText="FIRST NAME" dataField="Fname" width="150" />
<mx:AdvancedDataGridColumn headerText="LAST NAME" dataField="Lname" width="150" />
<mx:AdvancedDataGridColumn headerText="DOB" dataField="dob" width="150" />
<mx:AdvancedDataGridColumn headerText="TOTAL" dataField="Amount" width="100" textAlign="right" />
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Canvas>
<mx:Canvas label="Second" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:AdvancedDataGrid id="second_dg" dataProvider="{acSample}" x="10" y="10" width="890" height="150" editable="false" itemClick="setADGRow(event)"
sortableColumns="false" headerHeight="40" lockedColumnCount="1" >
<mx:columns>
<mx:AdvancedDataGridColumn headerText="FIRST NAME" dataField="Fname" width="150" />
<mx:AdvancedDataGridColumn headerText="LAST NAME" dataField="Lname" width="150" />
<mx:AdvancedDataGridColumn headerText="DOB" dataField="dob" width="150" />
<mx:AdvancedDataGridColumn headerText="TOTAL" dataField="Amount" width="100" textAlign="right" />
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Canvas>
</mx:TabNavigator>
</mx:Canvas>
</mx:TabNavigator>
</mx:Canvas>
</mx:TabNavigator>
</mx:TitleWindow>
</mx:Application> -
DataGrid rendering issue during runtime
Hi,
I have a data grid where the data during runtime
changes.Basically I use a tree structure in the first column of the
data grid where the top level rows will be displayed in the
beginning . Let's say at the beginning I have 2 rows and When the
user expands the 2nd row I fetch some more data and display it on
the Datagrid Again with the 2nd row expanded . One approach is to
reinitialise the Dataprovider and refresh the datagrid again .But I
feel this is not the right Approach .Is it possible to render the
results only to the existing Datagrid.
I have a custom item renderer to render the tree structure
for the first column.If I have the full XML in the beginning then
it works fine .But do not know if I can optimize it without
reloading the whole XML again.Hi,
I was looking into the Datagrid class and got to know that
the Dataproviders are associated with Change event .so I do not
really need to do anything If I am using the collection classes as
dataprovider.I also tested the same and it's working perfectly.I'm
not sure what will be the performance impact when I have huge data
.I guess it must have been implemented keeping the performance
issues in mind. -
I am using flex builder 2.01 and have been using datagrids
for a while now. I have recently ran into a weird situation where I
have one datagrid out of three that just will not allow a manual
selection. If I set the index to 0 for instance, the initial view
of the datagrid shows the first item selected. If I go to select a
different item, the first item becomes unselected and no other item
can be selected. If I leave the initial state to be no item
selected, I can never select an item. All other datagrids are
working fine. I have tried to set selectable to true but that
didn't help. This is really odd, any assistance would be greatly
appreciated.Mmmm... Well the good news is I fixed it. The bad news is I
have no clue why it fixed it. This particular datagrid is in a
different tab in a tabnavigator panel. Attached is the expanded
working code. On the line:
<mx:Canvas label="Archived" width="100%" height="100%"
id="ArchiveTab">
I had a click="{GetPropertyArchive()}" to refresh the data on
tab selection. This was old code that was made unnecessary at a
later date but I did not remove the code. My guess is the datagrid
assumed the characteristics of the parent tabnavigator and instead
of ... wait that can't be right. If that was the case then changing
the datasource would not have fixed the select issue because the
'click' definition on the tabnavigator still existed. I would
really like to understand why this mattered so I could avoid this
issue in the future. Any ideas?? -
I have a DataGrid inside a container with wordwrap turned on.
Some fields have a good chunk of data so they are allowed to
wrap. I have also set variableRowHeight to true (though it doesn't
affect the behavior below).
Once populated the Datagrid will not show the scrollbar when
it overflows the container area. Rather the container scrollbars
are turned on (both horizontal & vertical).
When I have WordWrap turned off, the overflow will trigger
the scrollbar for the Datagrid itself, not the container.
I am not sure what am I missing when I turn the wordwrap on
Appreciate any help/tip.
Thanks.Setting minWidth on the column with wrapping data fixed the
sxroll issue.
Now the scrollbars are appearing with the Datagrid. -
Problem: Focus got lost, while moving from one cell to another cell using tab key.
Example: In an AdvanceDataGrid, there are three columns having custom ItemRenderer with Spark TextInput control (editable=true & focusEnabled=true).
When I try to move the focus in with in 2nd, 3rd & 4th column using tab key, focus got lost. Most of the time it’s working, but some time it doesn’t work. There’s no clue as to how may rows/columns the focus has jumped to; or whether the focus has gone out of the data grid altogether.
Observations: I am not sure whether this problem is because of custom component implementation or it is because of some issue related to Flex Component.
It only occurs when we perform some actions like some server call, some complex logic execution etc. at the focus out event of itemrenderer.
There is one property of datagrid i.e. editedItemPosition which contains row & column index of datagrid. On the focus out event, it gets null when focus got lost. We tried to set it, but it didn’t work.
Steps Performed:-
1. Currently focus is in 2nd column i.e. Apply to #.
2. Once I press tab key from 2nd column, it goes to 3rd column which is correct.
3. Now if I press tab key from 2nd column i.e. Payment #, focus should go to 3rd column, but it goes out of data grid and set the focus of button which is outside data grid.http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2Bjtable+%2Btab+%2B%22enter+key%22&col=javaforums
-
DataGrid Sorting Issue with Hotfix2
I already opened a ticket with Adobe on this, but since this
is a critical issue for us I wanted to post a message to see if
anyone has any idea where the issue in flex sdk lies.
Check tab 2 of the sample app, Sorting a datagrid who's
column only has partial data causes an error, works fine on Hotfix
1 (same test)
Sample App:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="creationComplete()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.utils.ObjectProxy;
[Bindable]
public var dgData:ArrayCollection = new ArrayCollection();
public function creationComplete():void
var object:ObjectProxy;
object = new ObjectProxy();
object["filled"] = "Filled A";
object["partial"] = "Partial A";
dgData.addItem(object);
object = new ObjectProxy();
object["filled"] = "Filled B";
object["partial"] = "Partial B";
dgData.addItem(object);
object = new ObjectProxy();
object["filled"] = "Filled C";
dgData.addItem(object);
object = new ObjectProxy();
object["filled"] = "Filled D";
dgData.addItem(object);
]]>
</mx:Script>
<mx:XMLList id="treeData">
<node label="Mail Box">
<node label="Inbox">
<node label="Marketing"/>
<node label="Product Management">
<node label="Large node Large Node Large Node Large
Node"/>
</node>
<node label="Personal"/>
</node>
<node label="Outbox">
<node label="Professional"/>
<node label="Personal"/>
</node>
<node label="Spam"/>
<node label="Sent"/>
<node label="Spam2"/>
<node label="Sent2"/>
<node label="Spam3"/>
<node label="Sent3"/>
<node label="Spam4"/>
<node label="Sent4"/>
<node label="Spam5"/>
<node label="Sent5"/>
<node label="Spam6"/>
<node label="Sent6"/>
</node>
</mx:XMLList>
<mx:TabNavigator height="100%" width="1005">
<mx:Canvas label="Tree Issue">
<mx:Text x="284" y="51" fontSize="16" fontWeight="bold"
text="Issue: Expand the tree node to open up Product Management
node, no Horizontal Scroll bar appears." width="390"/>
<mx:Canvas verticalScrollPolicy="auto"
horizontalScrollPolicy="auto">
<mx:Tree x="50" y="50" width="226" height="303"
dataProvider="{treeData}" labelField="@label"
verticalScrollPolicy="auto" horizontalScrollPolicy="auto"/>
</mx:Canvas>
</mx:Canvas>
<mx:Canvas label="DataGrid Issue">
<mx:DataGrid id="dgTest" dataProvider="{dgData}"
width="500" height="300" x="10" y="10">
<mx:columns>
<mx:DataGridColumn headerText="Filled Row"
dataField="filled"/>
<mx:DataGridColumn headerText="Partially Filled Row"
dataField="partial"/>
</mx:columns>
</mx:DataGrid>
<mx:Text x="10" y="318" fontSize="16" fontWeight="bold"
text="Issue: Toggle the sort in the column that has only partial
data. You will get a find criteria error. This worked in Hotfix 2
and was broke in Hotfix 2." width="390"/>
</mx:Canvas>
</mx:TabNavigator>
</mx:Application>Hi,
With new hotfixes some bugs ( most of bugs) in Flex SDK are
get fixed, but rarely new (sometimes critical) bugs can appear.
Before Flex 3 release which will allow on IDE level to switch
between different versions of Flex SDK on the fly, I would advice
you to store locallly copy of all versions of Flex 2 SDK released
to the public. Then, in case if you will encounter a serious bug in
the most recent release of Flex 2 SDK, you can fix it by yourlself
by reusing the old code from former release of Flex 2 SDK.
See what I did with found bug in Flex 2.0.1 release, which is
what not present in Flex 2.0 SDK release:
jabbypanda.com/blog/?p=25 -
Dear Good Sirs,
I have encountered a problem with an app of mine where i have a datagrid that i refresh every 30 seconds. However on the refresh of the dataset i will loose the sorting that i have on my datagrid. I have trailed the net for various work arounds but so far have been unsuccessful and would appreciate some advice as to how i might be able to get around this issue. I take the data from a source url to provide and xml list. Sample below.
//where the data is coming from
mx:HTTPService id="httpGetOffers" url="testURL" method="GET"
resultFormat="e4x" result="doxmltestlist(event)" fault="fault(event)" useProxy="false" />
//my xmllist
[Bindable] private var xmltestlist:XMLList;
/result set
private function doxmltestlist(evt:ResultEvent):void
xmltestlist = evt.result.r;
//my grid
<mx:Panel title="Offer Bonds Only">
<renders:CitiDataGrid id="dgtestsort" dataProvider="{xmltestlist}" rowCount="20" variableRowHeight="true"totalRowColor="0xCCCCCC" >
<renders:columns>
<mx:DataGridColumn dataField="1" headerText="test1 sortCompareFunction="{numericSortByField('x')}"/>
<mx:DataGridColumn dataField="2" headerText="test2" sortCompareFunction="{numericSortByField('autonegtotaloffers')}"/>
<mx:DataGridColumn dataField="3" headerText="test3" sortCompareFunction="{numericSortByField('done')}"/>
</renders:CitiDataGrid>
Thanks in advance for your assistance.
PatrickIf you are resetting the dataprovider, you will have to save and re-apply
the sort. If the data items really aren't changing, it might be better to
find a way to update the current dataProvider. -
Datagrid sorting issues with 1/0 items to consider
Hi all,
I have an issue I can't find a way to fix. I am using a datagrid which I pouplate through a XMListCollection based on some XML datas.
XML:
var prefs:XML = <files>
<file name="@toto" favourite="1"/>
<file name="@toto"favourite="0"/>
</files>;
XMLListCollection
var xlc:XMLListCollection = new XMLListCollection( new XMLList ( prefs.file) );
MXML
<mx:DataGrid id="filesList" width="100%" height="100%" dataProvider="{xlc}">
<mx:columns>
<mx:DataGridColumn width="25" dataField="@favourite"sortCompareFunction="favourite_sortCompareFunc"/>
</mx:columns>
</mx:DataGrid>
Sorting fucnction:
private function favourite_sortCompareFunc(itemA:Object, itemB:Object):int {
var value1:Number = Number( itemA.@favourite );
var value2:Number = Number( itemB.@favourite );
if(value1 < value2){
var n:Number = -1;
return n;
else if(value1 > value2){
return 1;
else{
return 0;
return 1;
Once loaded, the datagrid appears in a "normal state":
But if I try to sort first column, it becomes messy
I think it might be related to the fact that the data to be sorted is only made of 0 & 1. But I can't imagine this kind of situations is not fixable.
Any hint ?
Thanks in advance for any advice,
LoicHi guys,
First of all, all my apologizes for my silence. I had technical issues with Yahoo mail that made me miss 3 months mail ! So I just missed your posts and I can only come today to thank you all for your care and answers.
In the meanwhile, I finally got it working by doing…nothing. Let me explain. The issue was caused by equal datas ( 1 or 0 ). So Flex couldn't sort 1 and 1 or 0 and 0 by itself. But these 0 and 1 were flags for an itemrenderer made of a button in toggle mode. 1 standed for on, 0 for off.
Doing so I did override updateDisplayList and then the issue went away. But if I had to stick with pure datas ( 1 or 0 ) I think I would have had to do a custom sort function to deal with equal datas like a few of you offered.
@DonMitchinson the @ stands for the xml attribute as the datagrid is populated with XMLListCollection from an XML file.
Thanks for your sharing,
Best,
Loic -
I have created a datagrid which has suppose 4 columns out of which 1 has an option of setting as favorite just like we have in our every mail servers (gmail, yahoo, outlook, etc). I have used a linkbutton as an item renderer and its toggle property as true. so wenever i click on it its getting selected and i have used skin for selected and normal state which is a star.
The problem is that when data length exceeds and scrollbar comes in datagrid and whenever i scroll down and up the stars which are not selected are getting selected or in some scenarios the whole column stars get selected.
How to get rid of this problem ?Can I see the itemrenderer code. I'm assuming that you aren't clearing the values from previous objects in you
override protected function set data( value:Object ):void call.
Sincerely ,
Ubu/ -
I have a few datagrids, when I load them in FLASH on the
local machine, they populate fine, but when I upload them to the
internet, the datagrid displays but the data doesnt populate. Is
this common, am I not doing something? The data source is a mySQL
DB via a PHP file, and I know the PHP file is working, because when
I load it from the local machine, I use "
http://www.mydomain/myPHPfile.php".
so it is going out to the server and working fine.
Thanks
~ChrisOK, so after a little testing, heres the situation. I have
tried this on 5 different machines and the 3 different OS's and 3
Different Browsers. I tried this on Firefox, IE7 and IE8 Beta. All
of them have the latest version of Flash and Windows updates. 1 out
of 5 works fine. So the datagrid is working fine, the PHP is
working fine, and the DB is working fine. Does anyone know why it
only works on 1 out 5 machines?
Win 2008 Server: Doesnt populate
2 PC's running Win Vista: Doesnt Populate
1 Virtual Machine running XP: Doesnt Populate
1 PC running XP: This does Populate fine
Maybe you are looking for
-
I'm a newbie so I hope I can explain my problem satisfactory. My problem at hand is that I have, lets say a (JFrame) main class that does most of the work, within this class I instantiated another class that extends JFrame and pass it a Vector. Withi
-
Extracting Audio From Copy-Protected DVD
I am doing the audio mastering of a feature film I've made. I'm wanting to extract the audio of a DVD I purchased so that I can see the wave form, study the audio dynamics, and see if I can attempt to match some of the eq characteristics toward my ow
-
we use ORACLE 11.1.0.7. We have couple of processes that run for about 2 to 3 hours which are scheduled to run after 6 pm. When these processes run, currently users are not allowed to access the system . So last week we ran these processes with 30 to
-
Switchover in a data guard environment using Grid Control 10.2.0.3
I've tested switchover in a data guard environment using Data Guard Broker in Grid Control. However, at times, i receive the message "RemoteOperationException: failed to establish input streaming thread". It looks like it has problems connecting to t
-
Unable to set Answers from Java Script
Hi, After user selects the answer for a particular question, i am able to get the selected answer using below Java script. var cp = document.Captivate; alert(cp.cpEIGetValue("m_VarHandle.cpQuizInfoAnswerChoice")); Based on some user info, i want to s