-
Notifications
You must be signed in to change notification settings - Fork 16
Filter
FLAX.Filter - it central thing in FullAJAX library that make AJAX-ed (wrap) all links/forms that matched some filters :) Can be couple Filters in one time
-
add(options)- add filter rule, have the same options that HAX so options look at About HAX HtmlAjaX + optionparentthat allow to filter by parent block of the link -
remove(options)- remove/rewrite some options -
clear(id)- clear filter with given ID -
clearAll()- clear all filters that defined before
-
beforewrap- fires before each link/form wrapping
All internal links that matched to ‘/’ will be processed with FullAJAX, and request result will placed in block with id="forFullAjax":
FLAX.Filter.add({url:'/', id:'forFullAjax'});All internal links that matched to ‘/short-news’ will be processed with FullAJAX without using History, and request result will placed in block with id="left-block", params:'request=news' - can be used for identify request on server side:
FLAX.Filter.add({url:'/short-news', id:'left-block', nohistory:true, params:'request=news'});All links that inside block with block-id will be processed with FullAJAX, and request result will placed in block with id="forFullAjax":
FLAX.Filter.add({parent:'parent-id', id:'forFullAjax'});or by parent class parent-class:
FLAX.Filter.add({parent:'.parent-class', id:'forFullAjax'});Ignore (no wrap) some links.
by path:
FLAX.Filter.add({url:'/administrator.html', type:'nowrap'});by query:
FLAX.Filter.add({query:'format=pdf', type:'nowrap'});By path and query in one time:
FLAX.Filter.add({url:['/administrator', '/news-links'], query:['format=pdf','task=edit'], type:'nowrap'});Filter by parent block ID:
FLAX.Filter.add({parent:'parent-id', type:'nowrap'});Filter by parent block Class:
FLAX.Filter.add({parent:'.parent-class', type:'nowrap'});Also, you can prevent wrapping by adding for anchor the attribute: ax:wrap=”0″
<a href="mulink.html" title="My Link" ax:wrap="0">My Link</a>Similar for prevent wrapping for a form:
<form ax:nowrap="1" id="myform">Use events:
FLAX.Filter.on('beforewrap', function(options) {
if (options.el.id == 'myform') {
return false;//prevent wrapping
}
});