Flexicious : single footer with dynamic levels - apache-flex

Using ultimate flexicious datagrid with enableDynamicLevels="true", I try to have an unique footer instead of one per level.
Is that possible ? And if yes, how ?
Thanks !

Which version are you on? If you get the latest version, there should be an event dynamicLevelCreated. The level property of the event dispatched is the newly created level. You can set enableFooters=false in there. dynamicLevelCreated="testODG1_dynamicLevelCreatedHandler(event)"
protected function testODG1_dynamicLevelCreatedHandler(event:FlexDataGridEvent):void
{
event.level.enableFooters=false;
}

Related

how to get event type that is fired

I am working on Flex project these days and having java background. In my current task, same pop up is opened when two different types of custom events are being fired and I have to hide a button for one event type. So, how i can get event type.
Thanks in advance.
The Event class has a property called type wich is a string stating what kind of event it is.
function eventHandler(event:Event):void {
trace(event.type);
}
Generally speaking, you can get it this way:
mc.addEventListener(MouseEvent.CLICK, myMethod);
function myMethod(evt){
trace(evt.type);
}

knowing the exact index clicked in a Flex tree event

Please, i have a tree component that dispatches an itemOpen event.
When the black triangle next to the yellow folder is clicked, that folder opens to expose its children.
Is there anyway to know the index of the open folder? there is a rowIndex property in the target property of the openItem event that stores the index but it is not accessible. Does anyone knows or have come across situations like this one?
Thanks
There is a function called itemRendererToIndex(itemRenderer:IListItemRenderer):int
ItemRenderer you can get from the dispatched event.
Adobe Documentation
Code smaple :
protected function tree1_itemOpenHandler(event:TreeEvent):void
{
var index:int = tree.itemRendererToIndex(event.itemRenderer);
trace(index);
}
You can always find the selectedItem using Tree(event.target).selectedItem. Thus, you can get the index of this item in your dataprovider. Hope it helps.

A way to keep DataGrid in same scroll position after update?

I have a custom <mx:DataGrid /> that is updated with data from a ColdFusion server every 60 seconds. I've noticed that every time the DataGrid updates and redraws the scroll position is reset to the top.
Is there a way I can preserve the scroll position for my DataGrid?
Thanks in advance.
I'm pretty sure you can use the verticalScrollPosition. Save it before the updated and reset it after the update. Keep in mind that if you're changing the dataProvider, the verticalScrollPosition may not be pointing at the same place in the old and new dataprovider.
Just to provide a bit more detail. The way I did this is create a variable called scrollPos then in
<mx:DataGrid id="someId" I used
scroll="scrollPos=someId.verticalScrollPosition"
Then after the dataProvider is updated I call a function:
private function setScrollPosition() : void {
someId.verticalScrollPosition = scrollPos;
}
or you can just set the variable instead of calling a function.

flex: cant edit item in Datagrid with override set data method

I've a custom itemRenderer for my datagrid. To set the actual data I use the following method:
override public function set data(side:Object):void{
...
}
As soon as I use this function the cell doesn't show up any item Editor anymore. Why is that? When I remove this function the itemEditor is working but with the wrong initialization data...
What's the proper way to handle this?
Thanks,
Markus
Have u called 'Super' on that method ?
Make sure that you also have an itemEditor that is correctly working or that you set the rendererIsEditor property to true and use the renderer as the editor.

AdvancedDataGrid problem with programmatically adding a column

I have a Problem with adding columns programmatically to a AdvancedDataGrid. The code:
var cols:Array = thisDataGrid.columns;
cols.push(dgc);
thisDataGrid.columns = cols;
does create a column, adds it to the cols array, bot the last code line has no effect. The cols wont be found in the thisDataGrid.columns property...
What could be the problem? I'm working with a test license, and on the advanceddatagrid the watermark shows up. Could this be a problem?
Thanks for help!
Markus
I had the same issue and resolved it by making sure that I add my ADG object into an active visual component. In my case, I just made a call to this.addElement( adg ) (or this.addChild() ) after updating the adg.column property.
It seems like the adg properties will only update when the adg is "attached" to an active visual component. I havn't taken the time to really look into the cause of this behaviour though.
try doing invalidateProperties() and invalidateDisplayList() on grid

Resources