Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
matteoannibali opened this issue May 31, 2024 · 4 comments
Open

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

matteoannibali opened this issue May 31, 2024 · 4 comments

Comments

@matteoannibali
Copy link

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
Copy link
Author

  _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();
    },

@olton
Copy link
Owner

olton commented May 31, 2024

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
  ...
})

@matteoannibali
Copy link
Author

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

@olton
Copy link
Owner

olton commented May 31, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants