Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need some help regarding bp AJAX – masonry grid reload

  • @cj-kruger

    Participant

    I have integrated the vanilla masonry grid into a theme – similar to what pinterest uses and the exact same script digg uses.. and all’s good except when I filter the groups / members via ajax ( eg: Most members, Newly created.. )

    The vanilla script has a function to reload the script but I’m not experienced in AJAX and need some advice on where would be best to place the script? Does the same call handle the members and groups and similar or are they separate and what am I looking for?

    Also can I filter the script not modifying the core or I could copy the bp ajax file into my child theme and modify it there?

    `$(‘#example_container’).masonry(‘reload’);`

    http://vanilla-masonry.desandro.com/docs/methods.html

    Any advice would greatly be appreciated :)

Viewing 7 replies - 1 through 7 (of 7 total)
  • @cj-kruger

    Participant

    To give you an idea of what happens, this is the initial page load where it places the groups correctly in a dynamic layout

    Image and video hosting by TinyPic

    This is after i filter via the ajax

    Image and video hosting by TinyPic

    If i need to elaborate or put together a example that you could test on, please let me know as I would really like to keep the ajax

    @cj-kruger

    Participant

    *bump*

    @cj-kruger

    Participant

    *thump*

    @calumac

    Member

    Sorry, can’t help but I’m experiencing similar problems having managed to get masonry to work with the Groups DIrectory I hit the tag & get nothing displayed, although I suspect that this is down to my css still being messy.

    Is it possible to write some sort of override function/ action for group-tags that also calls masonry reload (as you suggest) & put it into bp-custom.php which sits in your site’s plugin folder?

    Unfortunately I’m not familiar enough with Buddypress/ coding to know if this is possible – I guess it depends on whether it’s loaded before the group-tags plugin.

    @rogercoathup

    Participant

    You need to look at global.js

    If you look for the calls to bp_filter_request you can find the sections where all screen filter requests are handled

    If you copy / edit global.js into your own theme, make sure you don’t enqueue the bp-default file as well

    @calumac

    Member

    Roger
    Thanks for the insight, as I was on the point of giving up & I sort of get where you’re coming from.
    I’m still getting my php/ css in order before I embark on trying to fix this properly, it’s 90% working without the fix but have a huge space after the filtered groups which the tweak to global.js might fix.

    Cheers.

    @cj-kruger

    Participant

    I had another go playing with the global.js.

    When i use `var wall = new Masonry( document.getElementById(‘groups-list’) );`

    within the “When a navigation tab is clicked – e.g. | All Groups | My Groups” part, it rearanges the groups on click but then the groups load and the order is messed up again, I need to call my script after the groups have loaded.

    I was thinking of just delaying it but dont think that would be the right approach..

    Any suggestions?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Need some help regarding bp AJAX – masonry grid reload’ is closed to new replies.
Skip to toolbar