utils.base.js
UTILS.Base is extended by every component and forms the basic set of shared methods
Method |
Description |
Usage |
---|---|---|
getObjectName | object name (optional) | var name = box.getObjectName(); |
getObjectVersion | object version (optional) | var version = box.getObjectVersion(); |
fns | executes callbacks that were attached to a component | this.fns('onButtonClicked'); |
addCallback | attaches a callback to a component | box.addCallback('onButtonClicked',function(){ /* do something */ }); |
getId | id of the component instance (optional) | var obj_id = box.getId(); |
setId | sets id of the component (optional - defaults to UTILS.uuid()) | box.setId('box-123'); |
getTarget | gets the target element (jquery object) | var $target = box.getTarget(); |
setTarget | sets the target element ([selector] or jquery object) | box.setTarget('#box'); |
getAjaxData |
returns an object with 4 keys:
|
var ajax_data = this.getAjaxData();
ajax_data.url //=> some url
ajax_data.type //=> POST/GET (defaults to POST)
ajax_data.method //=> method to call (optional)
ajax_data.params //=> extra params to be passed in ajax call
ajax_data.content_type //=> content-type header set for the ajax call
|
setAjaxData | sets the options |
box.setAjaxData({
url: 'some url',
method: 'getAccessCode',
params: {
id: 5,
name: 'Jack Bauer'
},
content_type: 'application/x-www-form-urlencoded'
});
|