I have a data grid that is a component for another page. In one of 
the columns in the data grid I am providing a check box. The plan is 
for the user to click the check box and have the text in that row 
turn red. How to get that event to happen and is the fact that the 
data grid is component going to matter or not. I have provided te 
code below and suggestions would be great. Thank you.

---- data grid -----

<?xml version="1.0" encoding="utf-8"?>
<mxataGrid xmlns:mx="http://www.macromedia.com/2003/mxml"; 
rowHeight="35" width="800" height="302" 
alternatingRowColors="[#fafafa,#ffffff]" useRollOver="false" 
selectable="false" >
<mx:Model id="DXList" source="dxlist.xml"/>
<mxataProvider>{DXList.dxinfo}</mxataProvider>
<mx:columns>
<mx:Array>
<mxataGridColumn headerText="Dx Code" columnName="dxcode" 
textAlign="center" width="75" sortable="true" />
<mxataGridColumn headerText="Dx" columnName="dxdesc" 
textAlign="center" width="455" sortable="true"/>
<mxataGridColumn headerText="Dx Source" columnName="dxsource" 
textAlign="center" width="85" sortable="true"/>
<mxataGridColumn headerText="Delete" columnName="deleterx" 
cellRenderer="CheckCellRenderer" textAlign="center" width="55" 
sortable="false" />
<mxataGridColumn headerText="Reason" columnName="deletereason" 
cellRenderer="reasonlist" textAlign="center" width="90" 
sortable="false" />
</mx:Array>
</mx:columns>
</mxataGrid>

---- rendering file -----

//********************************************************************
********
//Copyright (C) 2003 Macromedia, Inc. All Rights Reserved.
//The following is Sample Code and is subject to all restrictions on
//such code as contained in the End User License Agreement 
accompanying
//this product.
//********************************************************************
********

import mx.core.UIComponent
import mx.controls.CheckBox

class CheckCellRenderer extends UIComponent
{

var check : 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 CheckCellRenderer()
{
}

function createChildren(Void) : Void
{
check = createClassObject(CheckBox, "check", 1, {styleName:this, 
owner:this});
check.addEventListener("click", this);
size();
}

// note that setSize is implemented by UIComponent and calls size(), 
after setting
// __width and __height
function size(Void) : Void
{
check.setSize(20, layoutHeight); 
check._x = (layoutWidth-20)/2;
check._y = (layoutHeight-16)/2;
}

function setValue(str:String, itembject, sel:Boolean) : Void
{
check._visible = (item!=undefined);
check.selected = item[getDataLabel()];
}

function getPreferredHeight(Void) : Number
{
return 16;
}

function getPreferredWidth(Void) : Number
{
return 20;
}


function click()
{
listOwner.editField(getCellIndex().itemIndex, getDataLabel(), 
check.selected);
}

}






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to