Button Example

Simple button class that run a callback function on a button click. Extends the Ext.Button from the Extjs version 3.4.

Usage: ‘\{\{button|id=ANY_UNIQUE_ID|handler={Function}|toggleHandler={function}|enableToggle={Boolean}|args…\}\}’

Mappia API


handler: {Function}({Component}, {EventObject})

{{Function}} called, on layer scope, when the button is clicked.
{{Component}}: This button.
{{EventObject}}: The click event.
Usage: |handler=function() {alert('btn on layer: ' + this.name + ' was clicked.');}|

Defaults to null

toggleHandler: {Function}({{Component}}, {{EventObject}})

Function called when a Button with {enableToggle} set to true is clicked.
{{Component}}: This button.
{{EventObject}}: The click event.
Usage: |toggleHandler=function(c,e) {alert('Btn pressed ' + e);}

Defaults to null

enableToggle: {Boolean}

{{Function}} called when the button is clicked.
{Component}: This button.
{EventObject}: The click event.
Usage: |enableToggle=true|

Defaults to false

functions: {Object}

Allows to create custom functions on the context of each layer. These functions can be used in any tool callbacks, in the tool callback must use the same name in this 'functions' property.
PS1: Functions only visible inside this layer.
PS2: Functions accessed by tools callbacks using his property name as: (this.functions.['onClick']) to refer the following onClick function:
functions: {
onClick: function() {
ExtjsUtils.ALERTIFY.log("Clicked Button");

Defaults to null

log: {Function}({{msg}},{{config}})

Shows an user notification (if enabled).

PS: The messages before layer loading are delayed, when it finishes only the last message will be shown.

@param msg {String} Notification HTML content.
@param config {Object} Message configuration parameters.
{force: {Boolean} Force to show notification even when disabled.
func: {Callback} Callback function when the notification is clicked.
onlyMsg: {Boolean} True to only show message and hide the close and the stop notifications, False otherwise.
Usage: ExtjsUtils.ALERTIFY.log('test msg', {force:true})

Defaults to undefined