buttons in a datagrid in flex - apache-flex

i am using a data grid in flex and i am generating data from a mysql server. However, my problem is with adding a button within the datagrid so each row has one.
i have set the columns itemRenderer to mx.controls.Button although with the buttons shown in the grid there is no label on them (even though one has been set) and the assigned click event does not trigger when hitting the button. anyone have any ideas or guidance on what i am doing wrong.
Thanks
Mark

Not to worry I have sorted it. anyone with a similar issue i suggest reading this
http://www.axelscript.com/2008/02/29/using-the-itemrenderer-with-a-datagrid-in-flex/
an excellent source.

Related

Spark Datagrid: issue with scrolling (selectionChange event)

I have a flex mobile project. In my homeview I have a spark datagrid. The selectionMode is "singleCell". I have an eventlistener on the datagrid which listens to the selectionChange event. When someone clicks on a cell, a callout view is showed with a list.
Now when I want to scroll in the datagrid (if it has many rows), obviously the selectionChange event is triggered instead of the normal scrolling. Does anyone has a solution for this?
The curious thing is, when you use a list (in place of a spark datagrid) with a change event (spark.components.supportClasses.ListBase.change), the list is able to say the difference between scrolling and a selection without any issue!
Correct, the issue is caused by the singleCell editmode #Al_Birdy.
I have semi-solved it by using a doubleclick event on the datagrid. The app will also be exported as a desktop application in the final stage so that isn't a real bad idea.
As www.Flextras.com pointed out, the datagrid is not yet optimized for mobile usage. If I may add something to that, it isn't that mature either. To solve this issue, basicly a likewise approach should be implemented like the list control has. In this control, this behaviour is implemented (the difference between a scroll event and a touch/click event). It kinda surprised me that the spark datagrid didn't had this behaviour. But then again it wouldn't surprise me they took the 'ol good desktop' component and ported it, which might explain everything.

Flash Builder:How to sort spark datagrid column when user clicks header?

I am trying to sort a spark datagrid column when users click the header of individual column. I have searched google but haven't found any good tutorials. I would appreciate if anyone here can help me out. Thanks a lot.
Did you set sortableColumns to true? Cause actually it should work right out of the box if that property is set.

Adding drag & drop to a datagrid column in flex

I have two datagrid components and I would like to drag one column from one component to the other. I have been trying several methods but I couldnt acomplish that.
Can anybody help me with this?
What you want to do is to disable a column on the first datagrid and enable it on the second. You have to listen to DRAG_START events, find what field is the target column, and hide it on the first datagrid when the drag succeeds. Then you use a symetrical approach for the second datagrid...
I guess you will have to create a custom drag proxy visual component if you want it to be visually coherent.
Good luck =)

Flex/AS3 easy (I hope) drag and drop question - prevent dragging to other controls

I searched but couldn't find my answer, I'm sure it's easy for anyone with a little experience. I have multiple datagrids on a page, each one I want sortable with drag and drop, but I don't want items drug from one control to the other. How can I prevent a user from dragging an item out of a conrol. I would prefer to have it just stop moving with the mouse, but I am prepared to just completely cancel out of the dragging if need be.
I was trying to do something like this
dragExit="dragEvent.CANCEL"
This is obviously wrong, but I can't find the correct way to do it.
Thanks in advance.
~Mike
Ok, so you have an app with multiple drag/drop datagrids, and you only want items dragged within a datagrid, and not from 1 to the other, is how I understand this.
What you need to do is create a custom dragDrop event handler for each datagrid which has the following command: event.preventDefault(). This in effect will stop a datagrid from receiving items from another .
This does not prohibit the dragging an item outside its host's borders, but it will prohibit the item being dropped into a different datagrid.
HTH.

flex datagrid autoscrolling

I am showing the web service data into flex application using datgrid.
I need to show this data scrolling automatically in continuous manner.
Anyone knows how to do this stuff?
Assuming you don't need to dynamically get the data once a certain scroll position is reached, you just need to update the verticalScrollPosition property.
Check out Creating an auto-scrolling DataGrid control in Flex on FlexExamples, I think that's exactly what you're asking.
If you had a dataset that was 100 items and wanted to tween it down to the last one, using TweenMax, you could do something like (though I'm not sure exactly how the datagrid gets the max scroll position:
TweenMax.to(dataGrid, 1, {verticalScrollPosition:dataGrid.maxVerticalScrollPosition});
Hope that helps!

Resources