[ 4 posts ]

jc m

  • Username: pandore
  • Joined: Wed Sep 28, 2011 5:54 am
  • Posts: 2
  • Offline
  • Profile

Existing Events

Post Posted: Wed Sep 28, 2011 6:29 am
+0-
Hello,

I have started learning YUI3, unfortunately without much experience on YUI2.

When using the on( event, ...) function, 'event' is a string representing the event name.

So my question is. Given a Widget, how does one know which events are triggered by this widget?

Maybe the answer is obvious but I have been able to find it ...

Thanks

Pandore

Nick Husher

YUI Contributor

  • Offline
  • Profile

Re: Existing Events

Post Posted: Wed Sep 28, 2011 10:23 am
+0-
I think it's probably better that you have no YUI2 experience; the transition from 2 to 3 is a radical one that can be hard to get used to.

You can get a rundown on all the events a particular component publishes by checking out the API documentation for the component. Widget, for example, defines "init", "destroy", "contentUpdate", and "render" events.

Also, any component that makes use of the Attribute utility will fire events whenever one of their attributes change. These events take the form of "attributeNameChange", where "attributeName" is the name of the attribute that is changing. For example, if a component has an attribute "width", it would fire the event "widthChange" any time you called myComponent.set('width', someNewWidth)

The documentation isn't perfect, but that should get you started for the common use cases. Also, check out the user guides and example code. Good luck!

jc m

  • Username: pandore
  • Joined: Wed Sep 28, 2011 5:54 am
  • Posts: 2
  • Offline
  • Profile

Re: Existing Events

Post Posted: Wed Sep 28, 2011 10:57 am
+0-
Thanks!

I want to display a data table and respond to row selection.

I have not seen an attribute representing a selection (nor any event). Maybe data table is not the right widget? Nothing on data source neither.

Should I listen to event fired by the "focused" attribute?

Thank you

Regards

Nick Husher

YUI Contributor

  • Offline
  • Profile

Re: Existing Events

Post Posted: Wed Sep 28, 2011 8:03 pm
+0-
I did a little poking around, and it doesn't appear that the DataTable widget actively tracks the selected state of the elements within it. Depending on how complex your specific needs are, it might be easy to implement a plugin that would bootstrap this functionality onto the class, though.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum