Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: ihkawiss on August 02, 2013, 07:10:45 AM

Title: Eventlistener for Maillist
Post by: ihkawiss on August 02, 2013, 07:10:45 AM
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
Title: Re: Eventlistener for Maillist
Post by: SKaero on August 02, 2013, 10:27:46 AM
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
Title: Re: Eventlistener for Maillist
Post by: ihkawiss on August 02, 2013, 11:14:55 AM
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
Title: Re: Eventlistener for Maillist
Post by: SKaero on August 02, 2013, 12:14:22 PM
Your setting up the EventListener's wrong, take a look the plugin documation: http://trac.roundcube.net/wiki/Doc_Plugins#ClientscriptsandUIelements
Title: Re: Eventlistener for Maillist
Post by: ihkawiss on August 05, 2013, 01:59:51 PM
Worked, thanks SKaero and sorry for not reading carefully the documentation :)

Best regards ihkawiss