[ 9 posts ]

mark.kharitonov

  • Joined: Sat Sep 15, 2012 3:12 am
  • Posts: 217
  • Offline
  • Profile

How to trace all the events?

Post Posted: Sun Sep 23, 2012 6:29 am
+0-
I would like to learn more about the events occurring in my datatable. How can I configure it to display all the events either in the browser console or in a YUI console?

My YUI instance is configured with
Code:
{
  filter: 'raw',
  debug: true,
  combine: false
}

So, I figured I shoud see the events in the browser log, still no events, so I guess I must be missing something.

Thanks.

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 638
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Sun Sep 23, 2012 6:43 am
+0-
Try { filter: 'debug' }

mark.kharitonov

  • Joined: Sat Sep 15, 2012 3:12 am
  • Posts: 217
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Sun Sep 23, 2012 7:04 am
+0-
Yep, it works. And the next natural question has to do with filtering. Can I filter the events by origin and or event type?

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 638
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Sun Sep 23, 2012 7:49 am
+0-
You should read http://yuilibrary.com/yui/docs/api/classes/config.html. There are several log options than you can use.

mark.kharitonov

  • Joined: Sat Sep 15, 2012 3:12 am
  • Posts: 217
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Mon Sep 24, 2012 8:06 am
+0-
I guess you mean logInclude and logExclude.

Thanks.

mark.kharitonov

  • Joined: Sat Sep 15, 2012 3:12 am
  • Posts: 217
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Mon Sep 24, 2012 8:30 am
+0-
Still no dice. I am trying to understand why my widget:render event handler is never called.

So, I have:
Code:
YUI({
  filter: 'debug',
  debug: true,
  combine: false,
  logInclude: {widget: true},
  gallery: 'gallery-2012.05.23-19-56'
}).use(


Code:
advancedSearchPanel = new Y.Panel({


and

Code:
advancedSearchPanel.on('widget:render', function () {


The panel is shown with
Code:
advancedSearchPanel.show()


The 'widget:render' handler is not called and I do not see the event log messages either.

So, what is wrong?

(BTW, do event sources coincide with the respective module names? if not, how do you know the log sources?)

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 638
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Mon Sep 24, 2012 8:40 am
+0-
That's a documentation bug. The correct name of the event is "render".

I filed a ticketThat's a documentation bug. I filed a ticket (http://yuilibrary.com/projects/yui3/ticket/2532779) and will try to fix it later.

mark.kharitonov

  • Joined: Sat Sep 15, 2012 3:12 am
  • Posts: 217
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Mon Sep 24, 2012 8:50 am
+0-
All I want is subscribe to the show event of the panel. I am trying

advancedSearchPanel.subscribe('show', function () {

It does not work.

I am trying

advancedSearchPanel.on('widget:render', function () {

It does not work.

Can someone explain how the **** thing works?

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 638
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: How to trace all the events?

Post Posted: Mon Sep 24, 2012 3:50 pm
+0-
There are two things that determine if a Widget (any Widget, Panel included) is visible:

- The widget is rendered (widget.render() was called), that is inserted into the page
- The widget is visible (the "visible" attribute is set to true)

You can subscribe for the rendering of the widget via the "render" event:

widget.on('render', function () {})

And you can listen to the change of the "visible" attribute via the "visibleChange" event:

widget.on('visibleChange', function (e) {
if (e.newVal) {
// widget is now visible
}
});

If you widget starts with "visible" set to true, you don't need to listen to the "visibleChange" event if you just want to know when the widget is first shown.

I recommend that you read the Widget component User Guide
  [ 9 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