Coder Social home page Coder Social logo

Comments (5)

linmasahiro avatar linmasahiro commented on July 19, 2024 1

@bolerio
I add new feature to support v-slot, maybe can solve your problem. check #15 please.
And I will be close this issue. If you any question, reopen.

from vue3-table-lite.

linmasahiro avatar linmasahiro commented on July 19, 2024

Hi, @bolerio
Sorry, not support template yet.
But if you want to use "vue-router", you can code like this. It's work.

table column:

        {
          label: "Name",
          field: "name",
          display: function (row) {
            return (
              '<a href="#" data-link="' + row.link + '" class="is-rows-el route-link">' + row.name + '</a>'
            );
          },
        },

finished event:

    const tableLoadingFinish = (elements) => {
      table.isLoading = false;
      Array.prototype.forEach.call(elements, function (element) {
        if (element.classList.contains("route-link")) {
          element.addEventListener("click", function () {
            // router is your vue-router object
            router.push(this.dataset.link)
          });
        }
      });
    };

from vue3-table-lite.

arwinvdv avatar arwinvdv commented on July 19, 2024

Hi, I just made a very simple table where you can use slots.
Maybe someone can this combine with vue3-table-lite.

from vue3-table-lite.

WordpressArtist avatar WordpressArtist commented on July 19, 2024

@linmasahiro How to pass methods inside column display ??? its not working

display: function (row) {
return (
'<span class="pointer" @click="editThis(row)" class="t-color">Edit | Delete'
);
},

from vue3-table-lite.

linmasahiro avatar linmasahiro commented on July 19, 2024

@linmasahiro How to pass methods inside column display ??? its not working

display: function (row) {
return (
'<span class="pointer" @click="editThis(row)" class="t-color">Edit | Delete'
);
},

Hi, @WordpressArtist , Try change row display func to

// Point: Added 「is-rows-el」and 「edit-btn」class.
// Important:  If you need action any tag. 「is-rows-el」is require.
display: function (row) {
  return '<span class="is-rows-el edit-btn pointer t-color" data-row="' + JSON.stringify(row).replace(/"/g, '&quot;') + '">Edit | Delete</span>';
},

and Fix your 「tableLoadingFinish」event to like this

    const tableLoadingFinish = (elements) => {
      table.isLoading = false;
      Array.prototype.forEach.call(elements, function (element) {
        if (element.classList.contains("edit-btn")) {
          element.addEventListener("click", function () {
            editThis(JSON.parse(this.dataset.row));
          });
        }
      });
    };

This is work, but I don't recommend. I always pass require value only. Like this

display: function (row) {
  return '<span class="is-rows-el edit-btn pointer t-color" data-id="' + row.id + '">Edit | Delete</span>';
},
    const tableLoadingFinish = (elements) => {
      table.isLoading = false;
      Array.prototype.forEach.call(elements, function (element) {
        if (element.classList.contains("edit-btn")) {
          element.addEventListener("click", function () {
            editThis(this.dataset.id);
          });
        }
      });
    };

Hope help you.

from vue3-table-lite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.