Giter VIP home page Giter VIP logo

Comments (6)

matfish2 avatar matfish2 commented on August 28, 2024

You need to pass the table data to the direct parent component. Can't say for sure what you did wrong without seeing your code.

from vue-tables.

nikhil-pandey avatar nikhil-pandey commented on August 28, 2024

@matfish2 Here's what my code looks like. Just the example code.

...
var VueTables = require('vue-tables');
...
Vue.use(VueTables.client, {
    filterByColumn: true,
    perPage: 25
});
...
Vue.component('some-component', {
    data: {
        tableData: [
            {id:1, name:"John",age:"20"},
            {id:2, name:"Jane",age:"24"},
            {id:3, name:"Susan",age:"16"},
            {id:4, name:"Chris",age:"55"},
            {id:5, name:"Dan",age:"40"}
        ],
        options: {
            columns:['id','name','age']
        }
    }
});
...
<some-component>
    <v-client-table :data="tableData" :options="options"></v-client-table>
</some-component>

The example on jsfiddle works. But as soon as i make it a component, it stops working.

from vue-tables.

nikhil-pandey avatar nikhil-pandey commented on August 28, 2024

@matfish2 https://jsfiddle.net/57e0u3rm/ Reproduction of error. Am i doing something wrong here?

from vue-tables.

matfish2 avatar matfish2 commented on August 28, 2024

To render the HTML you need to add inline-template:
(http://vuejs.org/guide/components.html#Inline-Template)

<some-component inline-template>
    <v-client-table :data="tableData" :options="options"></v-client-table>
</some-component>

As a side note, component data should be returned from a function and not passed directly as an object:
(http://vuejs.org/guide/components.html#Component-Option-Caveats)

 data: function() {
    return {
        tableData: [
            {id:1, name:"John",age:"20"},
            {id:2, name:"Jane",age:"24"},
            {id:3, name:"Susan",age:"16"},
            {id:4, name:"Chris",age:"55"},
            {id:5, name:"Dan",age:"40"}
        ],
        options: {
            columns:['id','name','age']
        }
    }
}

from vue-tables.

nikhil-pandey avatar nikhil-pandey commented on August 28, 2024

Thanks. It Works. I did haveinline-template but did a typo.

from vue-tables.

matfish2 avatar matfish2 commented on August 28, 2024

It is working. You should replace data in your HTML with tableData

https://jsfiddle.net/matfish2/9pgoy80b/1/

from vue-tables.

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.