|
Simplest way to pinpoint the
problem is to keep generated files and review generated code. You can change the
code in click="" to click="mx.utils.Delegate.create(this, click)" if you think
that it fails context recognition. In most cases we would just delegate
processing to container with
click="listOwner.dispatchEvent({type:'arrowClicked',...})
I will try to
publish dynamic datagrid demo on one of our external servers this
week.
Thank you,
Anatole
----- Original Message -----
Sent: Tuesday, February 07, 2006 4:04
PM
Subject: [flexcoders] Re: cellRenderer
not recognizing click events for Custom Mxml Cell Renderer
Anatole- Thanks
for your response. I have traces in both my 'setValue() and 'arrowClick'
methods. I see the trace statements for both the setValue(...) and
arrowClick(event) methods when the com.StatusPicker cellRenderer is applied
to the mx:Datagrid mxml tag. However, for the dynamic datagrid, I only see
the trace statements for the setValue() method and no traces occur when I
click the arrow. arrgh. so frustrating. The fact that it renders it
correctly is the most frustrating part...why the click event that is
dispatched doesn't get picked up makes me curious to know what Macromedia's
code does when applying a cellRenderer b/c obviously I'm missing that in my
mxml file.
Is there an example mxml file that does work with dynamic
datagrids I can try to plugin? I guess a last resort option is to write the
entire cell renderer in an Actionscript class but that I fear woul dlead
to more problems (and Actionscript forums) for me!
Cheers.
--- In [email protected], "Anatole
Tartakovsky" <[EMAIL PROTECTED]> wrote: > > I am using both
mxml and AS - works in both. Try to use trace in setValue to verify if the
trace output is sent. Also, I am not sure what you mean by saying that you
add mxml dynamically - it is either referenced in the code statically with
var _fake:com.StatusPicker=null; or has to be in RSL preloaded into
the application. > HTH, > Anatole > > >
----- Original Message ----- > From: Kevin Ewok
> To: [email protected] > Sent:
Tuesday, February 07, 2006 1:17 PM > Subject: [flexcoders]
Re: cellRenderer not recognizing click events for Custom Mxml Cell
Renderer > > > I have traces at the beginning
of my 'arrowClick' method which is > linked to the click
event of the button. When the mxml file is applied > to the
mx:DataGrid cellRenderer...I see all traces. However when I
add > the mxml file dynamically, I do not see the trace of
my 'arrowClick' > function. > > I'm
creating my datagrid dynamically from a XML file (mx:model).
It > looks like this: > >
<columns> > <column
name="TRIP_STATUS" headerText="Status" width="58" >
cellRenderer="com.StatusPicker"
/> > <column
name="VEHICLE_NUM" headerText="Veh" width="40" >
editable="false" /> > ....etc... >
</columns> > > in which case I'd loop through
the model and call: > if(column.cellRenderer !=
undefined) > { >
_dgc.cellRenderer = column.cellRenderer; > } >
> It renders the component, but the click event doesn't
call the method. > Are you using pure ActionScript classes
as your cellRenderers or mxml > files? I think I'm missing
something when I just add the mxml file in > the code below
as if the children are not getting created correctly. >
> Thanks again for your help. > >
--- In [email protected], "Anatole Tartakovsky" >
<anatolet@> wrote: > > > >
Kevin, > > I am a bit confused.
Do you have other traces in the > application? Can you see
them? Here is tracer that I use : > http://ajaxmaker.com/xpanel >
> We are using cellrenderers within dynamic
datagrids (layout > persisted in DB) all the time - no
issues there - they do have > mouseDown and click handlers.
I personally would not name the method > "click" as it is
confusing to me but would call it arrowClick(). >
> click event is not handled by the parent or
propagated to the > parent. Your control should define
custom event and dispatch it to the > listOwner so the
parent can react on it. > > HTH, > >
Anatole > > ----- Original Message -----
> > From: Kevin Ewok >
> To: [email protected] >
> Sent: Tuesday, February 07, 2006 10:01 AM >
> Subject: [flexcoders] Re: cellRenderer not recognizing
click > events for Custom Mxml Cell
Renderer > > > >
> > Hello all- >
> I've spent the last day now trying to get a
handle of the dispatched > > event from
the cell renderer to the mxml file and I still cannot
do > > it. I've tried several of the
techniques in Chapter 16 of the > >
"Developing Rich Clients" Flex book and still no luck. >
> > > What boggles me is that the 'click'
event w/i my cell renderer mxml > > file
works when I use the "cellRenderer" attribute of
the mx:Datagrid > > tag, but it doesn't
work when I apply my mxml file to the > >
.cellRenderer attribute of a dynamically created
datagrid. Obviously > > something is
getting lost b/w the parent object and my mxml file
where > > the dispatched event does not get
handled by the parent. I've tried > > all
sorts of fixes using 'parent' to no luck. > >
> > Does anyone know how this works?
Thanks. > > > > --- In
[email protected], "Kevin Ewok"
<suzylawson@> wrote: > >
> > > > Flexcoders
- > > > >
> > I have a mxml file which is basically copy
and paste from the > > > TimePicker.mxml
file. (except for my mxml file is just a label and a >
> > button). When the button is clicked, the value of the
label is > passed > > >
to the Cairngorm Controller. This works completely fine when
I > > > implement my mxml file within the
<mx:DataGrid cellRenderer=".."/> > >
> attribute. > > > >
> > However, I also have the requirement to create
datagrids > dynamically. >
> > When I create my DataGridColumn and apply my mxml file
to the > > > 'cellRenderer' attribute, the
component appears correctly, but > when
I > > > click the button, the method
linked to my click event in the button > >
> never occurs. > > >
> > > I'm implementing the "click" method
within my mxml file that renders > > >
the label and button and I can't figure out what I'm doing
wrong > with > > > the
way the child is created. Thanks in advance. >
> > > > > var
_dgc:DataGridColumn = new DataGridColumn("newColumn"); >
> > _dgc.cellRenderer =
"com.StatusPicker"; > > >
> > > ////////
com.StatusPicker.mxml//////// > > >
<?xml version="1.0" encoding="utf-8"?> >
> > <mx:HBox xmlns:mx="http://www.macromedia.com/2003/mxml"> >
> > <mx:Script> > >
> <![CDATA[ > >
> > >
> var btn : MovieClip; > > > var
listOwner : MovieClip; > > >
var getCellIndex : Function; > > > var
getDataLabel :
Function;
> > > >
> > function click(){ > >
> trace("click occured"); >
> > } > >
>
> > > function setValue(str:String,
item:Object, selection:String):Void > >
> { > > >
status.text =
item.STATUS;
> > > } >
> > ]]> > > >
</mx:Script> > > >
> > > <mx:Label id="status"
textAlign="center" width="20"/> > > >
<mx:Button
id="RightArrow" icon="@Embed('/images/rightarrow.png')" >
> > click="click()"/> >
> > </mx:HBox> > >
> > > > > >
> > > > > >
> > > -- >
> 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 > >
> > a.. Visit your group
"flexcoders" on the web. >
> >
> b.. To unsubscribe from this group, send an
email to: > >
[EMAIL PROTECTED] >
> >
> c.. Your use of Yahoo! Groups is subject to
the Yahoo! Terms of > Service. > >
> > > > >
------------------------------------------------------------------------------ >
> > > > > > > >
-- > 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 > > a.. Visit
your group "flexcoders" on the
web. >
> b.. To unsubscribe from this group,
send an email to: >
[EMAIL PROTECTED] >
> c.. Your use of Yahoo! Groups is
subject to the Yahoo! Terms of Service. > >
> ------------------------------------------------------------------------------ >
--
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
|