Honestly I think this is as good as any
solution for 1.5. I believe we’re gonna try to support single cell
selection a little better in 2.0 (though I’m not sure you’d see
that in the alpha).
Matt
From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf
Of bhaq1972
Sent: Wednesday, October 19, 2005
7:39 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] mimic
Datagrid single cell selection issue
Hi all, i've got this little test app below where i'm using fillrect
() to mimic the selecting of an individual cell.
got a question.
variables xpos and ypos are set using unsupported
code. how can i
set them using supported code?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
<![CDATA[
var selectedCell_mc:MovieClip;
var dp = [{ one:"one",
two:"two", three:"three" },
{ one:"four", two:"five",
three:"six" },
{ one:"seven", two:"eight", three:"nine" },
{ one:"ten", two:"eleven", three:"twelve" },
{ one:"thirteen", two:"fourteen", three:"fifteen"
}];
function doCellPress(event)
{
if(selectedCell_mc)
{
selectedCell_mc.removeMovieClip();
}
var col_width =
dg.getColumnAt(event.columnIndex).width;
var xpos =
dg.rows[event.itemIndex-dg.vPosition].cells
[event.columnIndex]._x;
var ypos = dg.rows[event.itemIndex-dg.vPosition]._y+1;
selectedCell_mc =
canvas1.createChild(mx.core.UIObject);
canvas1.fillRect.call(selectedCell_mc, xpos, ypos,
xpos+col_width, ypos+dg.rowHeight, 0xCC0033, 50);
}
]]>
</mx:Script>
<mx:Canvas id="canvas1">
<mx:DataGrid
id="dg" editable="false" selectable="false"
dataProvider="{ dp }"
cellPress="doCellPress(event)">
<mx:columns>
<mx:Array>
<mx:DataGridColumn
columnName="one"/>
<mx:DataGridColumn columnName="two"
/>
<mx:DataGridColumn
columnName="three"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
</mx:Application>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS