Ajax
Options
defaults = {
params: null,
callback: null,
url: "",
ishtml: false, // false = json
isloader: true, // if true, automatically displays mProgress bar across the top of the page
cancelprevious: false, // Automatically cancel previous requests with the same signature
delay: false, // Wait [delay] seconds before executing request. If multiple requests with the same signature are made within the delay window, the delay is reset
loadingButton: null, // jquery Object or selector
contentType: 'application/json; charset=utf-8' // for form submits, we want to use 'application/x-www-form-urlencoded; charset=UTF-8'
};
Example
child.ajaxSimulation = function () {
$.fdAjax({
url: "/Framework/Button/LoadingSimulation",
loadingButton: this.element
});
};
Code Editor
The code editor javascript file isn't included by default. If you want to use the code editor on a page, include a reference to "~/ui/ace/ace.js"
Options
defaults = {
height: 150,
theme: 'twilight',
readonly: true,
mode: 'javascript'
};
Example
child.init = function () {
$('pre').codeEditor();
};
Enable Controls
There is a single call to this function as part of the initial logic on page load. You should only need to call it after dynamically adding new HTML page (e.g. after openining a modal or popover).
Options
The plugin function doesn't accept an options object. Instead, all configuration options are passed in via data-fd-* attributes on the relevant elements. Control functionality is set based on the data-fd-control attribute, so if this attribute is missing no functionality will be enabled.
Example
function getEditModal() {
$.fdAjax({
url: "/Test/Modals/GetEditModal",
ishtml: true,
callback: afterData
});
function afterData(result) {
$(MODAL_ELEM).html(result.data).enableControls().modal('show');
}
}