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
Sent: Friday, February 10, 2006 10:29 AM
To: [email protected]
Subject: RE: [flexcoders] How to handle this DataGrid request

 

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
Sent: Friday, February 10, 2006 10:00 AM
To: [email protected]
Subject: Re: [flexcoders] How to handle this DataGrid request

 

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 -----

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).

Any of you Flex gurus got an idea on how to tackle this? It’s a Friday and my thinking process is thinking weekends.

_________________________________________

Jonathan Miranda

Flexible Master of the Web

"In the game of chess, it's important to never let your opponent see your pieces."





--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to