niiknow / vue-datatables-net

Vue jQuery DataTables.net wrapper component
https://niiknow.github.io/vue-datatables-net/
MIT License
171 stars 58 forks source link

Allow icons in data-action element #56

Closed papajin closed 2 years ago

papajin commented 3 years ago

Hi niiknow, Thank you for your component! It spared me some time and a lot of nerves. I would suggest to use e.currentTarget instead of e.target in the data-action element click handler.

$el.on('click', '[data-action]', function (e) {
      e.preventDefault();
      e.stopPropagation();
      var target = jq(e.target); // <--here jq(e.currentTarget); 
      var action = target.attr('data-action'); // no action, simply exit
      if (!action) {
        return;
      } else {
        var tr = target; // detect if action is inside a row
        // get data from parent row/tr
        ...
     }
     ....
}

Current code breaks at the if (!action) return, if icon clicked. Thank you once again!

noogen commented 2 years ago

Resolved in previous pulled request.