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

feat: TableBuilder sugar #1190

Merged
merged 1 commit into from
Aug 20, 2024
Merged

Conversation

lee-to
Copy link
Collaborator

@lee-to lee-to commented Aug 20, 2024

New TableBuilder sugar methods clickAction, pushState, removeAfterClone

TableBuilder::make()
    ->fields([
        Text::make('Title'),
    ])
    ->items([
        ['title' => 'Test']
    ])
    ->buttons([
        ActionButton::make('Go', '#')
            ->class('some-class')
            ->inModal('Title')
    ])
    ->clickAction(ClickAction::EDIT, '.some-class')
    ->pushState()
    ->removeAfterClone()

ClickAction

When you click on a table row, a click occurs on a specific button (via a selector) by default the selector is '.js-(edit|detail)-button'

pushState

If the table is asynchronous, then the called URLs are saved in the browser history

removeAfterClone (system method)

An empty table row will be cloned into memory and deleted.

@lee-to lee-to merged commit 89b47bf into moonshine-software:3.x Aug 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant