Jump to:

23355 Posts in 17873 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » How to add a custom filter in modeladmin?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 156 Views
  • BenWu
    Avatar
    Community Member
    87 Posts

    How to add a custom filter in modeladmin? Link to this post

    I have got a class

    class Product extends DataObject {
    static $many_many = array('categories'=>'Category');
    }

    and

    class Category extends DataObject {
    static $belongs_many_many = array('categories'=>'Category' );
    static $has_one = array('Parent' =>'Category');
    }

    I would like to filter products by sub-categories only, If I put

    $searchable_fields = array('Categories.ID' )


    in the Product class, i will have a dropdown box list all categories (including the Parent ones), which is messy

    156 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.