[flexcoders] Problem while sorting DataGrid column

2010-04-08 Thread Patil Yogesh

I saw an weird behavior while sorting datagrid column.

1. Launch an application with editable datagrid one tab of any browser.
2. Datagrid should have more values than its height so that vertical scroll
bar appears...
3. Click on any one column header to sort that column
It works perfectly fine
4. Open other tab from the same browser and then come back to the tab in
which application is launched.
5. Again click on column header in order to sort the column.
Actual Behavior: Vertical scroll changes its position each time we click on
column header.
Expected Behavior: Vertical scroll should not change its position as it
behaved as mentioned after step 3.

Here is the sample application:
?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/halo 
minWidth=1024
minHeight=768

s:Panel width=100% height=25%
mx:DataGrid 
x=0 y=45
width=100% height=100%
rowHeight=25
fontSize=12 fontWeight=normal borderVisible=false
editable=true
wordWrap=true

mx:dataProvider
fx:Object col1=World of Warcraft 
col2=Blizzard col3=Blizzard
col4=dasf col5=sdgf/
fx:Object col1=Halo col2=Bungie 
col3=Microsoft col4=dasf
col5=sdgf/
fx:Object col1=Gears of War col2=Epic 
col3=Microsoft col4=dasf
col5=sdgf/
fx:Object col1=XYZ col2=Epic 
col3=Microsoft col4=dasf
col5=sdgf/
fx:Object col1=ABC col2=Epic 
col3=Microsoft col4=dasf
col5=sdgf/
fx:Object col1=123 col2=Epic 
col3=Microsoft col4=dasf
col5=sdgf/
fx:Object col1=4687 col2=Epic 
col3=Microsoft col4=dasf
col5=sdgf/
/mx:dataProvider

mx:columns
mx:DataGridColumn dataField=col1/
mx:DataGridColumn dataField=col2/
mx:DataGridColumn dataField=col3/
mx:DataGridColumn dataField=col4/
mx:DataGridColumn dataField=col5/
/mx:columns
/mx:DataGrid
/s:Panel
/s:Application

If I remove editable=true property from datagrid then it works as
expected.

Does anybody else faced the same issue? Is there any workaround for this
issue?
Please let me know if anybody knows any workaround for this issue.

-
--
Regards,
Yogesh Patil.
-- 
View this message in context: 
http://old.nabble.com/Problem-while-sorting-DataGrid-column-tp28182757p28182757.html
Sent from the FlexCoders mailing list archive at Nabble.com.



[flexcoders] Tree Control behaves weirdly on drag and drop operation.

2010-02-26 Thread Patil Yogesh

I am trying to construct dataprovider from two different sources in Tree
control. I am able to construct it but when I perform drag and drop
operation on nodes in tree, it gives a weird behavior.

Following is the prototype for that:

?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/halo
initialize=initTree(event)

fx:Script
![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;

[Bindable]
private var treeData : ArrayCollection = new 
ArrayCollection();

[Bindable]
private var testData : ArrayCollection;

[Bindable]
private var testData2 : ArrayCollection;

protected function initTree(event:FlexEvent):void
{
testData = new ArrayCollection([{label:One}, 
{label:Two},
{label:Three}]);
testData2 = new ArrayCollection([{label:One}, 
{label:Two},
{label:Three}]);
createDataProvider();
treeControl.dataProvider = treeData;
}

private function createDataProvider() : void {
for(var i : int = 0; i  testData.length; i++) {
var label : String = testData[i].label;

var list : ArrayCollection = new 
ArrayCollection();

list.list = testData2.list;

var filter : Function = function(obj : 
Object) : Boolean {
if(obj.label == label) return 
true;
return false;
};

list.filterFunction = filter;
list.refresh();

treeData.addItem({label:testData[i].label, children:list});
}
}
]]
/fx:Script
mx:VBox width=100%
mx:Tree id=treeControl width=100% right=-1 left=-1 
bottom=-1
top=44 borderAlpha=0.75
 dragEnabled=true dropEnabled=true/
/mx:VBox

/s:Application



-
--
Regards,
Yogesh Patil.
-- 
View this message in context: 
http://old.nabble.com/Tree-Control-behaves-weirdly-on-drag-and-drop-operation.-tp27726203p27726203.html
Sent from the FlexCoders mailing list archive at Nabble.com.



[flexcoders] Problem while updating tree control

2010-02-22 Thread Patil Yogesh

I am facing a problem while updating dataprovider for tree control.

DataProvider is dependent on two different data sources. Using which I
am building new collection which acts as a dataprovider to tree control.

I want to add/update/delete data in either one or both data sources. It
should get reflected in tree control. But I am facing problem while doing
so

I have expended nodes in tree and then if i try to update data source, tree
control does reflect the changes but it closes all expanded nodes.

Following is the sample prototype:
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/halo
initialize=initTree(event)

fx:Script
![CDATA[
import mx.collections.ArrayCollection;
import mx.events.CollectionEvent;
import mx.events.FlexEvent;

[Bindable]
private var treeData : ArrayCollection = new 
ArrayCollection();

[Bindable]
private var testData : ArrayCollection;

[Bindable]
private var testData2 : ArrayCollection;

private var openItems : Object;

private var refresh : Boolean = false;


//---
protected function initTree(event:FlexEvent):void
{

treeData.addEventListener(CollectionEvent.COLLECTION_CHANGE, update);
testData = new ArrayCollection([{label:One}, 
{label:Two},
{label:Three}]);
testData2 = new ArrayCollection([{label:One}, 
{label:Two},
{label:Three}]);
updateData();

}


//---
protected function button_clickHandler(event : 
MouseEvent):void
{
openItems = treeControl.openItems;
testData.addItem({label:updating});
updateData();
}


//---
// Build data provider as per requirement
private function updateData() : void {
var tree : ArrayCollection = new 
ArrayCollection();
for(var i : int = 0; i  testData.length; i++) {
var col : ArrayCollection = new 
ArrayCollection();
for(var j : int = 0; j  
testData2.length; j++) {
if(testData.getItemAt(i).label 
== testData2.getItemAt(j).label) {

col.addItem({label:testData2.getItemAt(j).label});
}
}

tree.addItem({label:testData.getItemAt(i).label, children:col});
}
treeData = tree;
}


//---
private function update() : void {
refresh = true;
}


//---
protected function 
treeControl_renderHandler(event:Event):void
{
if(refresh) {
treeControl.invalidateList();
refresh = false;
treeControl.openItems = openItems;
treeControl.validateNow();
}
}

]]
/fx:Script
mx:VBox width=100%
s:Button id=button click=button_clickHandler(event) 
label=Click/
mx:Tree id=treeControl width=100% right=-1 left=-1 
bottom=-1
top=44 borderAlpha=0.75 dataProvider={treeData}
 render=treeControl_renderHandler(event)/
/mx:VBox

/s:Application

-
--
Regards,
Yogesh Patil.
-- 
View this message in context: