Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Allow options to be passed to columns #176

Open
gthomas2 opened this issue Aug 19, 2019 · 0 comments
Open

Allow options to be passed to columns #176

gthomas2 opened this issue Aug 19, 2019 · 0 comments

Comments

@gthomas2
Copy link

gthomas2 commented Aug 19, 2019

If I want to create a dynamic component for selecting data at the cell level, it's necessary for me to tell the dynamic component what the select options are as well as the currently selected value. At the moment, the only way I can do this is to (very hackily) use the row property. Possibly, a better way to do this would be to add an extra "options" property when tdComp dynamic components are instantiated - note, that this options property would be something that could be defined at the column level so that it is no longer necessary to have to specify the select options per row.

        <!-- <td> component (tdComp) -->
        <component
          v-if="col.tdComp"
          :is="forDynCompIs(col.tdComp)"
          :row="item"
          :field="col.field"
          :value="item[col.field]"
          :options="col.options ? col.options : null"
          :nested="item.__nested__"
          v-bind="$props">
        </component>

N.B - I'm using 'options' here as a non component specific container for extra data that could be used with any dynamic component. Other examples of usage could be disabling a dynamic component for an entire column - in this case the column date would be col.options.disabled = true.

BTW - such a shame that this datatable component is deprecated. More than anything, I'm adding this issue here so that I can make my change and then file a pull request. Then if anyone else needs the same kind of functionality they can take a look at my code.

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

No branches or pull requests

1 participant