Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Sort GridField by Column


Go to End
Reply


14 Posts   2635 Views

Avatar
pinkp

Community Member, 168 Posts

28 April 2013 at 3:09am

Edited: 02/06/2013 6:37am

Thanks again RuthAdele!

So basically I have a list of Members. Each has a name, image, website, description and most importantly a Discipline.
The discipline is chosen from an enum array, so this is limited to say 10 disciplines. There is potential to have 100's of Members so I think a form sounds best.

Ideally I would have the user visit the Members page and be presented with a list of Members probably divided in to pages containing 10 results using Pagination (still need to work that out)

Then they need to be filtered by Discipline. Say with a drop down list. "Search members by there discipline: *dropdown*" This would then return only members from that discipline. I don't mind how this works as long as its easy for the user and looks smart.
I was advised to look at this http://api.silverstripe.org/3.0/source-class-DataObject.html#2692-2746 but i dont have the knowledge yet how to implement it.

One last addition would be that each member when clicking their name is taken there own page displaying all their info... but this is all to come.

:)

Avatar
pinkp

Community Member, 168 Posts

17 May 2013 at 9:06pm

Can anyone help me create this filtering / search function for my members? Thanks

Avatar
RuthAdele

Community Member, 19 Posts

18 May 2013 at 12:47am

oops, I did mean to get back to you on this.

so: search function: you know PHP right? Just write a form, set action="{$Link}/nameoffunction"
and then have a function in your controller called nameoffunction where you do what you need to with your POST data, and return a paginated list (see below link)

Pagination: http://doc.silverstripe.org/framework/en/howto/pagination (simple google search found this)

You could use this module (https://github.com/arambalakjian/DataObjects-as-Pages) to make your dataobjects (i.e. the members) act as pages. which takes care of the link through to their own page bit.
Or you could write your own version - this is an old (but good) example. http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/ (some syntax might be slightly different for SS3, but essentials are the same.

I think that covers it all. Happy coding!!

Avatar
pinkp

Community Member, 168 Posts

20 May 2013 at 10:49am

Edited: 20/05/2013 10:50am

Thanks for your reply.

No I don't really know PHP, I do build everything from start to finish but rely on Modules and adapting existing code and basic extensions.
So that part is something I could really use some help or a clear example for.

I did find the Pagination I just haven't tried using it yet.

Data Objects as Pages doesn't seem to work for SS 3.0.5 which I'm using. Even though it states is for SS3. It doesn't seem to be compatible with the latest version so I'll need to do something different..

I will give this tutorial a go and see where I get to.. (http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/)
but seeing as it uses DataObjectManager I will need to try the same thing with GridField.

thanks for your guidance.

Avatar
RuthAdele

Community Member, 19 Posts

20 May 2013 at 11:56am

The DataObejcts as pages module does work with SS3 - I'm using it on a project at the moment. :)

Avatar
pinkp

Community Member, 168 Posts

3 June 2013 at 10:43am

Hi RuthAdele, I now have everything working using DataObjectsasPages Module its perfect. My members, their data, images, the own pages etc.
I just need to add a search and filter to the front end. Ideally a search bar to allow generic name and content searching of the members. And also a filter system to only show results based on members Discipline in the form of radio buttons or drop down list.

I've been looking at this: http://www.silverstripe.org/all-other-modules/show/6641?start=40

I haven't created this before so any guidance would be great? thanks

Go to Top