This macro emulates a multi-page view for the contents. Very useful when used in Combination with ConfiForms custom layout |
This is my page 1
|
This is my page 2
|
This is my page 3 |
It uses Div container user macro
Here is how it is configured. We have 3 divs, with IDs given as mypage1, mypage2 and mypage3. Also for mypage2 and mypage3 we setup CSS to make them hidden on load
And we have setup the macro to work on these DIV elements, giving as parameter their IDs in a comma separated format
## @param Pages:title=Comma separated list of element IDs|type=string|required=true|desc= ## @param noAutoInit:title=Initialise on load|type=boolean|required=false|desc=Initialises pages on load. Uncheck this option to auto-initialise, Check this option if you plan to initialise manually, by calling initCfDialogPages() method <script type="text/javascript"> AJS.toInit(function() { initCfDialogPages(); }); function initCfDialogPages() { var pagesParam = '${paramPages}'; var pages = pagesParam.split(','); for(i=0;i<pages.length;i++) { if (i > 0) { AJS.$('#' + pages[i]).append('<button type="button" class="aui-button" id="cfPrevPage'+pages[i]+'" data-current="'+pages[i]+'" data-div="'+pages[i-1]+'" onclick="showPageDiv(this)">Previous</button>'); } if (i < pages.length-1) { AJS.$('#' + pages[i]).append('<button type="button" class="aui-button" id="cfNextPage'+pages[i]+'" data-current="'+pages[i]+'" data-div="'+pages[i+1]+'" onclick="showPageDiv(this)">Next</button>'); } } } function showPageDiv(btn) { var currentDiv = AJS.$(btn).attr('data-current'); var showDiv = AJS.$(btn).attr('data-div'); AJS.$('#' + currentDiv).hide(); AJS.$('#' + showDiv).show(); } </script> |