Open adrian-stein opened 8 years ago
+1
Needed this for a project so hacked something together. It’s horrible (tight deadline, what can I say?) but it works: https://gist.github.com/kinglozzer/076668800c9e4b35ec40d92b3e3f6a00
Just use BetterButtonBetterNestedForm::create()
instead of BetterButtonNestedForm::create()
. Make sure your actions return a string with a success message, it’ll get added to the parent form (the one outside the dialog) and perform a hard refresh
This sort of relates to [https://github.com/unclecheese/silverstripe-gridfield-betterbuttons/issues/126] but could also be classed as a new issue. I can close and comment on the other one if that is the case.
When using
BetterButtonNestedForm
on an order object I am setting the order as archived and entering an invoice number, I then save the object that I was viewing from the custom action. This saves the object but gives errors. InupdateBetterButtonsActions
I have a check to only show the archive button if the order is not archived and when I click the action to archive it I get the error "Action archive doesn't exist or is not aBetterButtonNestedForm
". I assume this is because the button is not included as the order is now archived. I guess I can get around this by making sure to add a button that has the same type and action name but does nothing if the order is already archived, but this doesn't sounds like a great way or doing it.Ideally it should be able to do one of 2 things:
BetterButtonNestedForm
it updates the entire page so the archive button is not rendered on the page ( will have to happen before I close the dialog)Controller::curr()->redirect('admin/orders');
from the custom action but this redirects the iframe in the ssdialog and not the parent page. I dont mind if it redirects back to the list page and shows all orders or the existing page but with updated information.Is there already a work around to get past this issue? As updating the record you are viewing with a
BetterButtonNestedForm
seems like a fairly common task, but I note your example doesnt save data just send a message.Cheers Adrain