ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Sort resulting code by using links

October 20, 2010 10:17am

Subscribe [7]
  • #1 / Oct 20, 2010 10:17am

    I was not quite sure what to search for in the forums for this topic, so I apologize in advance if this is a repeat.

    I have a staff directory which outputs just fine using this code.

    {exp:channel:entries channel="staff_directory" dynamic="off" orderby="last_name" sort="asc"}
    {title}
    {/exp:channel:entries}


    I was wondering how I would go about creating links to sort the results based on a field in the channel (staff position)

    link1 link2 link3

    lets say link1 was administrators. Clicking link1 would re-sort the staff members showing the administrators only (or putting the administrators first in the results)

  • #2 / Oct 20, 2010 11:53am

    LMO

    203 posts

    Hello Racine Lutheran High School,

    I would not try to accomplish this within EE. To much work and the page would have to refresh every time the user clicked on a reorder link because you would be do this on the server side. I would recommend doing this on the client-side with JavaScript. If you do not have a lot of js knowledge use something like jQuery with this plugin (http://tablesorter.com/). I’ve used it a few times and it is very easy to set up. Usually just adding a few <head> links and making sure your <table> structure is setup correctly.

  • #3 / Oct 20, 2010 1:04pm

    What would it take to do it in EE? Refreshing the page to resort the items is ok with me

  • #4 / Oct 21, 2010 2:36am

    John Henry Donovan

    12339 posts

    Racine Lutheran High School,

    Take a look at Dynamic Parameters which should take you in the right direction. It would use a dropdown menu to filter results

  • #5 / Oct 14, 2011 12:55pm

    Phil Ecker

    78 posts

    John,

    Is there anyway to use dynamic parameters without having to use a submit button?  So when a user selects “date” it would sort by date.

  • #6 / Oct 17, 2011 11:27am

    Mark Bowen

    12637 posts

    Hi Phil,

    What you are looking for is some sort of Ajax sorting of which there is nothing built-in to ExpressionEngine to allow this out of the box.

    If you had all your results in a table though you could use something like Tablesorter to allow you to do this on the display side of things.

    If you do need to actually bring data in, Ajax style though then this would require some custom coding which I’m afraid would be outside the scope of support here.

    Does that help at all though?

    Thanks,

    Mark

  • #7 / Oct 17, 2011 1:30pm

    Phil Ecker

    78 posts

    Sure does, Thanks Mark, I was assuming that was the case.

  • #8 / Oct 17, 2011 2:28pm

    Sue Crocker

    26054 posts

    Hi, Phil. Do you still require assistance, or are you good to go?

  • #9 / Oct 17, 2011 4:14pm

    Phil Ecker

    78 posts

    Yes Sue, I am good to go. Thanks!

  • #10 / Oct 17, 2011 5:58pm

    Sue Crocker

    26054 posts

    Racine Lutheran High School - what about you?

  • #11 / Oct 17, 2011 7:04pm

    ejaedesign

    240 posts

    You can also use Freebie to add a non-parsing segment and use it as part of your conditional.

    Freebie doesn’t work for segment_1, but may be an interesting alternative.

  • #12 / Oct 18, 2011 10:11am

    Mark Bowen

    12637 posts

    Racine Lutheran High School

    Just wanted to see if you’re all set now?

    Thanks,

    Mark


    Thanks for the information there Jae.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases