DataTables / DataTables/Vue

Is there a way to specify a Vue component inside of the columns declaration?

Open
#38 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vue
Stars
78
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Hi there. Big fan of the change that now allows you to use Vue components in named slots, but I had a question/feature request (not sure if it's already implemented). Is there a way to specify a Vue component that will be used WITHOUT using a named slot?

For example, let's say that I want to have a list of button columns that I may or may not want to render, or I want to change the order on them. The point is that using a named slot wouldn't easily allow that. Is there a way to instead pass the Vue component directly in the defined columns of the DataTable component props?

I imagine it would look something like this:

// MyVueComponent is the just the imported vue component
const things: ConfigColumns[] = [{ data: null, render: MyVueComponent, additionalProps: {testProp: 5} }];

But as far as I can tell this isn't supported? I took at look at the DataTable Vue component source code and I think it looks feasible to implement with the existing logic of how Vue components are rendered, along with passing additional props. I might be able to try what I want in a PR if that would be preferred.

Please let me know if I need to give any more information. Thanks for your time!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DataTable Vue component source code and review the existing named-slot rendering and columns declaration logic. Done means a column can accept a Vue component without a named slot, pass additionalProps to it, and preserve the requested column order; add or update coverage for that behavior if the project has relevant tests.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.