SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie again - help creating stat

    I think this is an easy one (just not for me)....

    I have a list of companies that can be filtered and I want to display "X of Y Companies" below the list.

    I can get the Y with a Company.count, but I'm not sure how to get the X.

    Any suggestions?

  2. #2
    l 0 l silver trophybronze trophy lo0ol's Avatar
    Join Date
    Aug 2002
    Location
    Palo Alto
    Posts
    5,329
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It's likely accessible through whichever filtered object you have. So if you have @filtered_companies filled with all of your filtered companies, you should be able to run some quick count on @filtered_companies rather than your entire Company model. I can't really test it right now, but if I recall correctly I think you can do @filtered_companies.size since @filtered_companies would be an array and that will count the number of items in that array.

  3. #3
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks!

    That worked!

    Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •