Elgg  Version 4.3
Functions
ajax-replace.js File Reference

Go to the source code of this file.

Functions

 define (['jquery', 'elgg/Ajax', 'elgg/system_messages'], function($, Ajax, system_messages){$(document).on('click', '.elgg-list-container-ajax-replace.elgg-pagination a', function(event){event.preventDefault();var $link=$(this);var href=$link.attr('href');var $target=$link.closest('.elgg-list-container');var ajax=new Ajax();ajax.path(href,{data:{_elgg_ajax_list:1,}, success:function(result){var id_selector= '#'+$target.attr('id');$new_html=$(result).find(id_selector).addBack(id_selector);if($new_html.length){window.history.pushState('', '', href);$target.replaceWith($new_html);var $target_list=$target.find('>.elgg-list');$target_list.trigger('change');$('html, body').animate({scrollTop:$(id_selector).offset().top}, 500);}else{require(['elgg/i18n'], function(i18n){system_messages.error(i18n.echo('ajax:pagination:no_data'));});}},});});})
 Ajax lists - replace behaviour. More...
 

Function Documentation

define ( function($, Ajax, system_messages){$(document).on('click', '.elgg-list-container-ajax-replace.elgg-pagination a', function(event){event.preventDefault();var $link=$(this);var href=$link.attr('href');var $target=$link.closest('.elgg-list-container');var ajax=new Ajax();ajax.path(href,{data:{_elgg_ajax_list:1,}, success:function(result){var id_selector= '#'+$target.attr('id');$new_html=$(result).find(id_selector).addBack(id_selector);if($new_html.length){window.history.pushState('', '', href);$target.replaceWith($new_html);var $target_list=$target.find('>.elgg-list');$target_list.trigger('change');$('html, body').animate({scrollTop:$(id_selector).offset().top}, 500);}else{require(['elgg/i18n'], function(i18n){system_messages.error(i18n.echo('ajax:pagination:no_data'));});}},});});}  )

Ajax lists - replace behaviour.