pax.widget

Base widget class for all PAX widgets

Author

Mikkel Bergmann, http://www.pointful.com

Summary
pax.widgetBase widget class for all PAX widgets
Properties
pax.widget.uniqueIdUnique identifiers counter for widgets
Functions
pax.widget.initInitialises a PAX widget
pax.widget.ajax.initThis creates an ajax based widget based on the widget object.

Properties

pax.widget.uniqueId

Unique identifiers counter for widgets

Functions

pax.widget.init

pax.widget.init = function(args)

Initialises a PAX widget

Parameters

argsObject with widget functionality
  • model - Model used by the associated widget template
  • paxWidgetId - Optionally specify a unique ID that can be used to identify an instance of a widget in the DOM (This is auto generated if not specified)
  • template - PAX Template (string) to render
  • templateURL - Optional URL to load a template from
  • target - Element to output the widget to

Returns

Object with model and various widget function.

Example

<div style='border: 1px solid grey' id='widget_output'></div>
[:.
    var myWidget = pax.widget.init( {
        model: {
            text: 'Hello, this is my first widget!'
        },
        template: 'Your text is: "[:= text :]".',
        target: $('widget_output')
    } );

    myWidget.render();
:]

This would show the template rendered in the target.  See pax.template for template details.

pax.widget.ajax.init

pax.widget.ajax.init = function(url,
args)

This creates an ajax based widget based on the widget object. ie: it adds a controller, and a server request method.

pax.widget.init = function(args)
Initialises a PAX widget
pax.widget.ajax.init = function(url,
args)
This creates an ajax based widget based on the widget object.
This PAX library can parse and render a PAX template
Close