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

Grid Row Actions #7

Open
willishq opened this issue Oct 15, 2018 · 2 comments
Open

Grid Row Actions #7

willishq opened this issue Oct 15, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@willishq
Copy link
Collaborator

willishq commented Oct 15, 2018

We need to be able to add actions to the grid, to be appended to each row.

I imagine it working like this:

$grid->addRowAction('view', '/view/url/for/row')
$grid->addRowAction('edit', '/edit/url/for/row')
$grid->addRowAction('delete', '/delete/url/for/row')

maybe the url for the row action should be a callback which gets passed the row.

When rendering the rowAction, it should also have a callback which returns the html.

echo $grid->renderRowAction('view', function ($url, $row) {
    return "<a href=\"{$url}\">View</a>";
});
echo $grid->renderRowAction('edit', function ($url, $row) {
    return "<a href=\"{$url}\">Edit</a>";
});
echo $grid->renderRowAction('delete', function ($url, $row) {
    return "<form action=\"$url\" method="POST"><button type=\"submit\">Delete</button></form>";
});
@willishq willishq added the enhancement New feature or request label Oct 15, 2018
@willishq willishq added this to To do in Query Grid via automation Oct 15, 2018
@willishq willishq moved this from To do to In progress in Query Grid Oct 15, 2018
@willishq
Copy link
Collaborator Author

I'm considering whether this is actually worth doing. The more I try to make the functionality, The more I think it would be easier to just create the buttons manually, rather than actually implement them this way.

If we create UI integrations for frameworks, maybe it'd be nice to add to the framework implementation, however the core package doesn't really need to know about them, and anything we can do to implement them I fear will just be bloat.

@maxalmonte14
Copy link
Member

I don't think this should be a core function, maybe the user wants to implement an action handled by Javascript or something else; also the package doesn't mix HTML and PHP until now, I think is better to keep it that way.

@willishq willishq removed this from In progress in Query Grid Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants