Roundcube Community Forum

 

Eventlistener for Maillist

Started by ihkawiss, August 02, 2013, 07:10:45 AM

Previous topic - Next topic

ihkawiss

Hello there

I would like to do some modifications on the maillist table structure. Thus I think that the table is generated within the core of roundcube, I'd like to do those modifications with Javascript.

Now, is there some rcmail.addEventListener or so which fires when maillist is loaded ? Is there an other way to change de structure ?

EDIT: I saw that messages are added by add_message_row in app.js. Is it for example possible to bind a event Listerner on this function without changing app.js ?

Thanks

SKaero

Depening on what your trying to do you could use the listupdate, insertrow, or the before* and after* hooks http://trac.roundcube.net/wiki/Plugin_Events

ihkawiss

Hello SKaero

Thanks for your reply! What I tried:

In ui.js file added following lines:

  function init()
  {

    rcmail.addEventListener('message', message_displayed);
    rcmail.addEventListener('insertrow', row_added);  // New row
    rcmail.addEventListener('listupdate ', list_updated); // List update
  }


callback functions look like this:

  function list_updated()
  {
      console.log("List Updated");
  }


  function row_added()
  {
      console.log("Row Added");
  }


Now when I load mail, and maillist is loaded, none of both callback events is fired.

Is there some issue in my code ?

Thanks a lot!

ihkawiss

SKaero

Your setting up the EventListener's wrong, take a look the plugin documation: http://trac.roundcube.net/wiki/Doc_Plugins#ClientscriptsandUIelements

ihkawiss

Worked, thanks SKaero and sorry for not reading carefully the documentation :)

Best regards ihkawiss