create(event)
Returns:
{{ModuleUpperCase}}
Setting the event which will be triggered when creating the {{ModuleLowerCase}} widget.
-
event
Type: function
The event to be triggered
Code examples
$A.new{{ModuleUpperCase}}({
create: function (){
console.log("{{ModuleUpperCase}} module created!");
}
}).draw()
addButton(obj)
Returns
Button | {{ModuleUpperCase}}
Adds a Button to the {{ModuleLowerCase}} widget.
Returns a Button if invoked without parameters.
Returns the {{ModuleLowerCase}} widget if invoked with parameters.
-
obj
Type: Object | Button
The Button to add, or an object used to build a new button.
Code examples
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw();
//Adding a new button with default parameters
{{ModuleLowerCase}}.addButton(); //returns the new button
//Adding a new button using object parameters
{{ModuleLowerCase}}.addButton({text: "NewButton"}); //returns {{ModuleLowerCase}}
//Adding an already existing button to the widget
var btn = $A.newButton({text: "NewButton"});
{{ModuleLowerCase}}.addButton(btn) //returns {{ModuleLowerCase}}
buttons
Array that contains all Button objects which are on the widget.
Code examples
Initialize the {{ModuleLowerCase}} widget with the buttons option specified, using object in constructor
//Adding two customized buttons to a new {{ModuleLowerCase}} widget
$A.new{{ModuleUpperCase}}({
buttons:[
$A.newButton({
text: "button1"
}),
$A.newButton({
text: "button2"
})
]
}).draw();
Initialize the {{ModuleLowerCase}} widget with the buttons option specified, using method chaining
//Adding two default buttons to a new {{ModuleLowerCase}} widget
$A.new{{ModuleUpperCase}}().buttons([$A.newButton(),$A.newButton()]).draw();
Get or set the buttons option, after initialization
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw();
//Setter
{{ModuleLowerCase}}.buttons([$A.newButton(),$A.newButton()]); //returns {{ModuleLowerCase}}
//Getter
console.log({{ModuleLowerCase}}.buttons()); //returns the buttons array
data
The .data() method allows us to attach data of any type to Automizy modules.
We can set several distinct values for a single element and retrieve them later:
Code examples
Initialize the {{ModuleLowerCase}} widget with the data option specified, using object in constructor
$A.new{{ModuleUpperCase}}({
data: {
foo: "asd",
myObject: { txt: "dsa", apples: 40 },
baz: [ 1, 2, 3 ]
}
}).draw()
Initialize the {{ModuleLowerCase}} widget with the data option specified, using method chaining
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw()
//Setters
{{ModuleLowerCase}}.data( "foo", "asd" ); //returns {{ModuleLowerCase}}
{{ModuleLowerCase}}.data( "bar", { myObject: "dsa", apples: 40 } ); //returns {{ModuleLowerCase}}
{{ModuleLowerCase}}.data( "baz", [ 1, 2, 3 ] ); //returns {{ModuleLowerCase}}
//Getters
console.log({{ModuleLowerCase}}.data( "foo" )); // returns the value which belongs to the "foo" key
console.log({{ModuleLowerCase}}.data()); // returns the whole data Object: { foo: "asd", bar: { myObject: "dsa", apples: 40 }, baz: [ 1, 2, 3 ] }
draw($target)
Returns:
{{ModuleUpperCase}}
Invoke this function to draw the widget after initialization on the target element.
Invoking without parameter sets $('body') as target.
Code examples
Simple way without parameter:
$A.new{{ModuleUpperCase}}().draw()
With jQuery element parameter
var container = $('<div id="{{ModuleLowerCase}}-container"></div>').css({height: '200px', margin: '20px 10px', border:'2px solid #FF0000', position:'relative'}).appendTo('body')
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}();
{{ModuleLowerCase}}.draw(container);
drawTo($target)
This method is an alias for the draw($target) method.
hide()
Returns:
{{ModuleUpperCase}}
Invoke this function to hide the widget.
Code examples
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw();
setTimeout(function (){
{{ModuleLowerCase}}.hide();
},1000);
id
Default value:
'automizy-{{ModuleLowerCase}}-' + $A.getUniqueString()
The default id of {{ModuleLowerCase}} widget, always starts with 'automizy-{{ModuleLowerCase}}-' followed by a unique string.
Code examples
Initialize the {{ModuleLowerCase}} widget with the id option specified, using object in constructor
$A.new{{ModuleUpperCase}}({
id: 'MyID01'
}).draw()
Initialize the {{ModuleLowerCase}} widget with the id option specified, using method chaining
$A.new{{ModuleUpperCase}}().id('MyID01').draw()
Get or set the id option, after initialization
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw()
//Setter
{{ModuleLowerCase}}.id('MyID01'); //returns {{ModuleLowerCase}}
//Getter
console.log({{ModuleLowerCase}}.id()); //returns vlue of id
remove()
Invoke this function to remove the widget.
Code examples
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw()
setTimeout(function (){
{{ModuleLowerCase}}.remove();
}, 1000);
removeButton(button)
Returns:
{{ModuleUpperCase}}
Removes the button from the {{ModuleLowerCase}} widget.
-
button
Type: Object | String
The Button or the ID if the button to remove.
Code examples
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw();
//Removing a button by object parameter
var btn = {{ModuleLowerCase}}.addButton();
setTimeout(function() {
{{ModuleLowerCase}}.removeButton(btn);
},1000);
//Removing a button by id
{{ModuleLowerCase}}.addButton({id: 'MyButton02'});
setTimeout(function() {
{{ModuleLowerCase}}.removeButton('MyButton02');
},1000);
show()
Returns:
{{ModuleUpperCase}}
Invoke this function to show the widget.
Code examples
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw().hide();
setTimeout(function(){
{{ModuleLowerCase}}.show();
},1000);
skin
Default value:
'simple-automizy'
Setting the skin of the widget.
Code examples
Initialize the {{ModuleLowerCase}} widget with the skin option specified, using object in constructor
$A.new{{ModuleUpperCase}}({
skin: 'simple-automizy'
}).draw()
Initialize the {{ModuleLowerCase}} widget with the skin option specified, using method chaining
$A.new{{ModuleUpperCase}}().skin('simple-automizy').draw()
Get or set the skin option, after initialization
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw()
//Setter
{{ModuleLowerCase}}.skin('simple-automizy'); //returns {{ModuleLowerCase}}
//Getter
console.log({{ModuleLowerCase}}.skin()); //returns value of skin
widget()
Invoke this function to get the jQuery object representing the {{ModuleUpperCase}} widget.
Code examples
var {{ModuleLowerCase}} = $A.new{{ModuleUpperCase}}().draw()
console.log({{ModuleLowerCase}}.widget());