how do i add a click handler to a custom jquery ui widget and use the widget property in the handler?

To address this, you will want to use an .on() for click and also call the gid via the Getter.

Example: https://jsfiddle.net/Twisty/6bmtnL1f/7/

JavaScript

  $("#tablesList").on("click", ".raspasy-table", function() {
    var myID = $(this).table("option", "gid");
    console.log('table clicked: ' + myID);
    alert('table clicked: ' + myID);
  });

I would advise moving this into the _create function. To do this, you add the .click() after the table has been created.

Example: https://jsfiddle.net/Twisty/6bmtnL1f/16/

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top