Metro-UI-CSS icon indicating copy to clipboard operation
Metro-UI-CSS copied to clipboard

@click vuejs click event into data-table "disappear"

Open matteoannibali opened this issue 1 year ago • 4 comments

if i put inside a column "ordered" using data-role="table": <a :href="'#" @click="openDialogGroup(group)" >test it disappears when i render the table...

How can i do?

matteoannibali avatar May 31 '24 09:05 matteoannibali

  _createItemsFromHTML: function(){
        var that = this, element = this.element;
        var body = element.find("tbody");

        if (body.length > 0) $.each(body.find("tr"), function(){
            var row = $(this);
            var tr = [];
            $.each(row.children("td"), function(){
                var td = $(this);
                **tr.push(td.html());** <--perhaps this remove @click event handler?
            });
            that.items.push(tr);
        });

        this._createHeadsFromHTML();
        this._createFootsFromHTML();
    },

matteoannibali avatar May 31 '24 09:05 matteoannibali

set click handler for table and specify it for td. I don't know how to do it in Angular, but if you use m4q, it will be like this:

$('#table-id').on("click", "td", function(){
   const td = this
  ...
})

olton avatar May 31 '24 11:05 olton

I need to preserve the keywords of "viewjs", it must not remove them, I can't call a viewjs method from vanilla js

matteoannibali avatar May 31 '24 13:05 matteoannibali

You can use the event data-on-draw-cell to generate link https://codepen.io/olton/pen/mdRwqBB?editors=1011

olton avatar May 31 '24 13:05 olton