Adobe Dreamweaver Forums



Last 10 THreads :         Eventlistener for exiting frame (Last Post : Andrei1 - Replies : 1 - Views : 2 )           »          CS4 Motion Editor issues (Last Post : jdehaan - Replies : 3 - Views : 9 )           »          Flash file won't display (Last Post : Murray *ACE* - Replies : 18 - Views : 19 )           »          How do I centre Tables ? (Last Post : Murray *ACE* - Replies : 3 - Views : 4 )           »          3 overlapping background images on same page (Last Post : Murray *ACE* - Replies : 9 - Views : 10 )           »          Can I make a 4 state CSS Sprite nav bar. (Last Post : Murray *ACE* - Replies : 7 - Views : 8 )           »          Re: Photoshop CS3 Keeps on Crashing at Random - Help! (Last Post : Ann_Shelbourne@adobeforums.com - Replies : 0 - Views : 1 )           »          bad luck (Last Post : Andrei1 - Replies : 1 - Views : 2 )           »          ActivMail (cf_mail) and Bare LF problem (Last Post : Fetch - Replies : 1 - Views : 2 )           »          Re: Lagging in CS3 Extended due to Antivirus permissions (Last Post : Lara_Shots@adobeforums.com - Replies : 0 - Views : 1 )           »         


User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-03-2008, 04:38 AM
MacGyverMan
 
Posts: n/a
Diggs:
Default ADG - Reacting when icon is clicked

I've got an ADG where each leaf node has one of 2 icons: a plus (if the item is
known as an adder) or a trash can (otherwise).

I've got the icon being set by iconfunction using the attached code.

How do I set it so that the user can click the icon and trigger a given
function (deleteItem in the case of the trashcan). Do I have to use a custom
itemRenderer with a button instead of an icon? I'd rather not, since I can't
seem to get my item renderers to make sense.


public function setIcon(item:Object):Class
{
if(item.hasOwnProperty('adder') && item['adder']==1)
return add;
else if(!item.hasOwnProperty('children'))//If there are children, the node
is a branch, so we don't want to enable deleting
return trash;
return null;
}



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-03-2008, 04:38 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: ADG - Reacting when icon is clicked


"MacGyverMan" <webforumsuser@macromedia.com> wrote in message
news:ge206t$12p$1@forums.macromedia.com...
> I've got an ADG where each leaf node has one of 2 icons: a plus (if the
> item is
> known as an adder) or a trash can (otherwise).
>
> I've got the icon being set by iconfunction using the attached code.
>
> How do I set it so that the user can click the icon and trigger a given
> function (deleteItem in the case of the trashcan). Do I have to use a
> custom
> itemRenderer with a button instead of an icon? I'd rather not, since I
> can't
> seem to get my item renderers to make sense.
>
>
> public function setIcon(item:Object):Class
> {
> if(item.hasOwnProperty('adder') && item['adder']==1)
> return add;
> else if(!item.hasOwnProperty('children'))//If there are children, the
> node
> is a branch, so we don't want to enable deleting
> return trash;
> return null;
> }


In your itemClick, look at the same information you look at in the
iconFunction property...


Reply With Quote
  #3 (permalink)  
Old 11-03-2008, 04:39 AM
MacGyverMan
 
Posts: n/a
Diggs:
Default Re: ADG - Reacting when icon is clicked

Thanks for the answer.

I've thought of that, however, I want to react differently when clicking the
icon than when clicking the row.

When clicking the row, the item editor opens up. If the trash can is clicked,
the user is prompted to delete the item

Reply With Quote


  #4 (permalink)  
Old 11-03-2008, 04:39 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: ADG - Reacting when icon is clicked


"MacGyverMan" <webforumsuser@macromedia.com> wrote in message
news:geas6f$l91$1@forums.macromedia.com...
> Thanks for the answer.
>
> I've thought of that, however, I want to react differently when clicking
> the
> icon than when clicking the row.
>
> When clicking the row, the item editor opens up. If the trash can is
> clicked,
> the user is prompted to delete the item


You still can determine if the situation is appropriate by looking at
exactly the same information.


Reply With Quote
  #5 (permalink)  
Old 11-03-2008, 04:39 AM
MacGyverMan
 
Posts: n/a
Diggs:
Default Re: ADG - Reacting when icon is clicked

How?

If the person clicks on the row itself, the editor opens up. If they click on
the trash, the item should be deleted. The info stored in the item will not
determine if the user want's to delete or edit the item.

Reply With Quote
  #6 (permalink)  
Old 11-03-2008, 04:39 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: ADG - Reacting when icon is clicked


"MacGyverMan" <webforumsuser@macromedia.com> wrote in message
news:gedo26$qoe$1@forums.macromedia.com...
> How?
>
> If the person clicks on the row itself, the editor opens up. If they click
> on
> the trash, the item should be deleted. The info stored in the item will
> not
> determine if the user want's to delete or edit the item.


Ah, I thought that the problem was that you didn't know which ones _had_
trash can icons. Edit your itemRenderer to generate a different event when
the trash can is clicked.


Reply With Quote


  #7 (permalink)  
Old 11-03-2008, 04:39 AM
MacGyverMan
 
Posts: n/a
Diggs:
Default Re: ADG - Reacting when icon is clicked

It's all good.

That's the problem I'm facing. I have no clue how to generate a different
event when the can is clicked.

Right now I'm not using a custom item renderer. I just used iconFunction to
make the icons.

I've tried the custom renderer, however, they don't indent to follow the tree
once it's expanded. They all align to the left..

Reply With Quote
  #8 (permalink)  
Old 11-03-2008, 04:39 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: ADG - Reacting when icon is clicked


"MacGyverMan" <webforumsuser@macromedia.com> wrote in message
news:gefndn$h6n$1@forums.macromedia.com...
> It's all good.
>
> That's the problem I'm facing. I have no clue how to generate a different
> event when the can is clicked.
>
> Right now I'm not using a custom item renderer. I just used iconFunction
> to
> make the icons.
>
> I've tried the custom renderer, however, they don't indent to follow the
> tree
> once it's expanded. They all align to the left..


You might be able to use a click event and look at the event.target and see
what the className is of the target. Then you'll have to walk up from there
to get the renderer itself and look at the data.

Or you could just subclass the AdvancedDataGridGroupItemRenderer and add an
event listener to the icon...


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 01:21 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk