|
Originally I was trying to do this the
easy way as an mxml file. As I have found many times when building
reusable parts a simple mxml file always falls short. So after figuring
out all the action script I was about to set the selected index in the click
event. Just seems like a lot of hoops to jump through. Thanks Jeff Base class class flex.component.core.DataGridLink
extends UIComponent { var link : MovieClip; var listOwner : MovieClip; //
The reference we receive to the list. var getCellIndex : Function;
// The function we receive from the list. var getDataLabel : Function;
// The function we receive from the list. function DataGridLink() { } function createChildren() :
Void { link
= createClassObject(Link, "link", 1, {styleName:this, owner:this}); link.addEventListener("click",mx.utils.Delegate.create(this,linkClicked)); link.setStyle("textDecoration","underline"); link.setStyle("color","#000099"); size(); } function setValue(str:String,
item:Object, sel:Boolean) : Void { link.label
= str; link.width
= (str.length * 9); } function getPreferredHeight()
: Number { return 16; } function getPreferredWidth()
: Number { return 60; } function linkClicked( event )
{
listOwner.selectedIndex = getCellIndex().itemIndex; } } Implementation <corecomponent:DataGridLink xmlns:corecomponent="flex.component.core.*"
xmlns:mx="http://www.macromedia.com/2003/mxml"> <mx:Script> <![CDATA[ import
flex.view.cm.VideoViewHelper; import
com.iterationtwo.cairngorm.view.ViewLocator; function
linkClicked( event ) { super.linkClicked(event); var
videoViewHelper = ViewLocator.getInstance().getViewHelper(
VideoViewHelper.LOOKUP_NAME ); videoViewHelper.openProjectScript(); } ]]> </mx:Script>
</corecomponent:DataGridLink> From: Can you just set selectedItem to be the
associated item for the Link? In setValue you’ll be passed a
reference to the item, so just hold onto it and then in the click event of Link
you set the DataGrid’s selectedItem to that. From: No I mean that when I click on the link it
does everything I want, the only problem is the row does not become selected.
When I hover over the link I get the
finger pointer. Jeff From: You mean the Link is bringing up an
I-beam? That seems odd to me, can you show some code? From: I am having the same problem, but my cell
renderer is not a text control but instead a link. There is no selectable
property on a link, so is there any other way I can get the link to receive the
click, but also have it select the row in the grid? Thanks Jeff From: David Gassner
[mailto:[EMAIL PROTECTED]
Yahoo! Groups Links
|

