Flex 3 Expand AdvancedDataGrid by Clicking Anywhere in the Row
Filed under ActionScript , Flex
One thing that has been bothering me for awhile about AdvancedDataGrid's in Flex 3 is that you have to click the little triangle to expand a row. A user, (Vice President), came to me wondering where all the data was located cause he didnt realize that you have to click the triangle (users have had worse questions). I decided to find a solution so that all you have to do is click anywhere in the row for it to expand.
Below is the actionscript private function that can be called by any AdvancedDataGrid:
|
private function adg_itemClick(e:ListEvent):void{ |
Now all you have to do is add an itemClick event in your AdvancedDataGrid mxml that calls the function. Add the appropriate AdvancedDataGrid id where you want this feature called (this example i used the id="testGrid". This is cool if you have multiple datagrids where you want to apply this feature.) Here is code:
| <mx:AdvancedDataGrid id="testGrid" width="100%" height="100%" itemClick="adg_itemClick(event);" > |
Make sure you use "itemClick" instead of "click" because click event is considered a mouse event and the function does not work. It should also be noted that you should type the private function out by hand so flex builder will create your import statements for you. Thought this was a userful little function.
| View count: 4589Dec31








