|
So close! Alright, I’ve got it that
I need to get to listData.rowIndex…..now my event is dispatched for the
click and in my function I can get to e.target (which is my ComboBox). I’ve attempted…. e.target.__listData (undefined) e.target.listData (null) ! e.target.dataObject.__listData (undefined) e.target.dataObject.listData (undefined) …and more dealing with
e.target.parent Since I am using a custom cellRenderer, I’m
not sure I’m getting this right. Any help with this would be awesome –
I’m so freaking close! Here’s my custom cellRenderer that
dispatches the event of clicking, and in my main application I grab the event
and am messing around with event.target…..(this renderer checks the box
depending on the dataProvider) <?xml version="1.0"?> <mx:HBox
xmlns:mx="http://www.macromedia.com/2005/mxml"
horizontalAlign="center"> <mx:Script> <![CDATA[ override public function set
dataObject(value:Object):void { if(value != null) { super.dataObject =
value; if (value.compare ==
true) compare.selected =
true; else compare.selected =
false; } } public function
toggleBtn(e:Event) { e.target.dispatchEvent(new
Event('toggleCompare',true)); } ]]> </mx:Script> <mx:CheckBox id="compare"
height="20" click="toggleBtn(event)"/> </mx:HBox> _________________________________________ Jonathan Miranda Flexible Master of the Web "In the
game of chess, it's important to never let your opponent see your pieces." From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin Check out the IDropInListItemRenderer
interface. The listData object is your friend (of type BaseListData and
then in other classes may be a subclass of that). From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Miranda Not going to work…if you say
selectable=false, the datagrid has no selectedIndex. _________________________________________ Jonathan Miranda Flexible Master of the Web "In the
game of chess, it's important to never let your opponent see your pieces." From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL :: guessing :: Maybe parent.selectedIndex? ----- Original Message ----- From: Jonathan
Miranda Sent: Friday, February
10, 2006 1:46 PM Subject: RE: [flexcoders]
How to handle this DataGrid request I am *super*
close to getting this, but I’m stuck on one thing. If I click the checkbox (custom
cellrenderer), I dispatch an event which changing the value in my dataProvider
by using selectedIndex. But I need to have set “selectable=false”
for the dataProvider, so I need to somehow know what row the checkbox is in
without using selectedIndex. Anything in the dataObject which says
which row you’re on? _________________________________________ Jonathan Miranda Flexible Master of the Web "In the
game of chess, it's important to never let your opponent see your pieces." From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Miranda Once again Jester, awesome help….but
I’m in Flex2 Beta ;) _________________________________________ Jonathan Miranda Flexible Master of the Web "In the
game of chess, it's important to never let your opponent see your pieces." From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL setValue in 1.5 actually sends you the selected state of the
row. You can thus do: if ( selected != "selected") { yourCH.selected = false; } else { yourCH.selected = true; } And, in your cellRenderer, you can access the grid via
listOwner property. yourCH.addEventListener("click",
Delegate.create(this, onClick)); function click() { if(yourCH.selected == false) return; var a:Array
= listOwner.selectedIndices; if(a == null) a = []; a.push(getCellIndex().itemIndex); } ----- Original Message ----- From: Jonathan
Miranda Sent: Friday, February
10, 2006 11:40 AM Subject: [flexcoders] How
to handle this DataGrid request I’ve a tricky job with a datagrid request from an employer
and wondering how I should tackle this. They want a datagrid that can do
multiple selections by a checkbox in a row – not your normal shift-click.
So you click on 3 checkboxes for 3 rows, and all 3 get selected. How can I bind the checkbox click to the datagrid
selectedIndices – is there an easy way to reference the datagrid through
the cellrenderer dataObject? Having a hard enough time getting the checkbox to
correctly sort and be remembered. I’m considering trying to “cheat”
and make it so when you click anywhere in the row, it selects that row and
checks/unchecks the checkbox – but even this is stumping me how I can
bind the cell-renderer checkbox to the selectedindices array or something
similar. I’ve actually ran this by and they’re fine with that, so
how can I bind selecting a row in a datagrid to checking that row’s
checkbox…and allowing normal clicks toggle what’s selected (not
shift-click). _________________________________________ Jonathan Miranda Flexible Master of
the Web "In the game of
chess, it's important to never let your opponent see your pieces."
|
- RE: [flexcoders] How to handle this DataGrid request Jonathan Miranda
- Re: [flexcoders] How to handle this DataGrid request Manish Jethani

