Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Remove delete actions from ResultForm

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1173 Views
  • moggen
    Avatar
    Community Member
    2 Posts

    Remove delete actions from ResultForm Link to this post

    Hi

    I'm using the ModelAdmin class witch gives me the built in search form that works great. But when my search result shows up it also displays the delete action or the red cross. My question is simple how do I overide the ResultForm function to not display the delete action ?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Remove delete actions from ResultForm Link to this post

    This is more of a ModelAdmin question that doesn't really relate to DOM, so you may get better advice in another forum.

    But my guess is if the canDelete() permission is false on the objects being returned, the delete button won't show.

  • moggen
    Avatar
    Community Member
    2 Posts

    Re: Remove delete actions from ResultForm Link to this post

    Ok then I know thanks for the answer any way.

  • Silverfish
    Avatar
    Community Member
    59 Posts

    Re: Remove delete actions from ResultForm Link to this post

    Yes, this is the way!

    Either remove the delete rights on searched objet for given user or simply make the object undeletable by overwriting canDelete() like

    public function canDelete() {
    return false;
    }

    This works for Editing (canEdit()) the same way.

    Regards
    SF

    1173 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.