ratiw / vue-table

data table simplify! -- vuetable is a Vue.js component that will automatically request (JSON) data from the server and display them nicely in html table with swappable/extensible pagination component.
MIT License
1.83k stars 303 forks source link

Request: Additional props for __component Special Field #149

Open Teumel opened 7 years ago

Teumel commented 7 years ago

Hello Rati, Thank you very much for such a great component! I enjoy the usage and also the pretty straight forward documentation.

My question: Do you think it is possible to add an "additional props" field when using the the __component - SpecialField that can be accessed inside the component in addation to the rowData? -

Example

columns:[
  {
     name:'__component:my-col-component,
     additionalProps: {
         prop1: {mypropvalue: 'valueOfProp1'}
         prop2: {[22, 335]},
         ...
   }
]

Component would look like this:

    Vue.component('my-col-component', {
        template: [
            '<div>Some Template</div>'
        ].join(''),
        props: {
            rowData: {type: Object, required: true},
            prop1: {type: Object, required: true},
            prop2 {type: Object, required:true)
       },
    });

Thanks for reading

ratiw commented 7 years ago

@Teumel I actually almost implemented that way. But I couldn't settle down on the way I feel about it and later found out that using events are better and cleaner. I would suggest you try using events to solve your problem first.

Also, in Vuetable-2 you can also use scoped slot via __slot:<name> special field.