Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Widget] Table Widget #5523

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[New Widget] Table Widget #5523

wants to merge 2 commits into from

Conversation

karandatwani92
Copy link
Contributor

WHY

Why not?
Screenshot 2024-05-17 at 4 29 04 PM

How to use

Widget::make([
    'type'        => 'table',
    'wrapperClass' => 'col-md-6',
    //'height' => '550px',
    'class' => 'table table-hover',
    'content' => [
        'header' => 'Sales Report 2024',
        'thead' => ['Month', 'Sales', 'Expenses', 'Net Income'],
        'tbody' => [
            ['January 2024', '$100,000', '$50,000', '$50,000'],
            ['February 2024', [
                'value' => '120,000',
                'prefix' => '$',
                'suffix' => '*',
                'limit' => 10,
                'wrapper' => [
                    'element' => 'a',
                    'class' => 'text-success fw-bold',
                    'href' => url('something'),
                    'target' => '_blank',
                    'title' => 'Send a new email to this user',
                ]
            ], '$60,000', '$60,000'],
            ['March 2024', '$130,000', '$70,000', '$60,000'],
            ['April 2024', '$140,000', '$80,000', '$60,000'],
            ['May 2024', '$150,000', '$90,000', '$60,000'],
            ['June 2024', '$160,000', '$100,000', '$60,000'],
            ['July 2024', '$170,000', '$110,000', '$60,000'],
            ['August 2024', '$180,000', '$120,000', '$60,000'],
            ['September 2024', '$190,000', '$130,000', '$60,000'],
            ['October 2024', '$200,000', '$140,000', '$60,000'],
            ['November 2024', '$210,000', '$150,000', '$60,000'],
            ['December 2024', '$220,000', '$160,000', '$60,000'],
        ],
        'tfoot' => ['Month', 'Sales', 'Expenses', 'Net Income'],
    ],
])->onlyHere()

@ziming
Copy link
Contributor

ziming commented Jun 10, 2024

looks great! does the table widget support actions & pagination?

@karandatwani92
Copy link
Contributor Author

Hey @ziming

Sorry, It's a simple table widget. One can set up link buttons using the wrapper for now.
When I submitted this PR, I was building reports using widgets in one of my projects and i needed a static table.

When I showed this small PR to the Backpack team. They told me the same as you asked... They said, People will ask for pagination & actions. 😀

Let's see how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Testing, Review or Docs
Development

Successfully merging this pull request may close these issues.

3 participants