API Docs for: Core 1.0.0.0.pre4, Basepack 1.0.0.0.pre3
Show:

Netzke.Base Class

Client-side code for Netzke::Base

Methods

netzkeActionHandler

(
  • comp
)

Common handler for all netzke's actions.

Parameters:

  • comp Ext.Component

    Component that triggered the action (e.g. button or menu item)

netzkeAfterConstructor

(
  • config
)

Called after constructor. Override as needed.

Parameters:

  • config Object

    Passed configuration

netzkeAfterInitComponent

()

Called after initComponent. Override as needed.

netzkeBeforeConstructor

(
  • config
)

Called before constructor. Implements all kinds of Netzke component initializations. Override as needed.

Parameters:

  • config Object

    Passed configuration

netzkeBeforeInitComponent

()

Called before initComponent. Override as needed.

netzkeBuildParentConfigs

()

Reversed array of server configs for each parent component up the tree

netzkeBuildServerLoadingParams

()

TODO

netzkeBulkExecute

(
  • instructions
)

Executes a bunch of methods. This method is called almost every time a communication to the server takes place. Thus the server side of a component can provide any set of commands to its client side.

Parameters:

  • instructions Array | Object
    1. a hash of instructions, where the key is the method name, and value - the argument that method will be called with (thus, these methods are expected to only receive 1 argument). In this case, the methods will be executed in no particular order.
    2. an array of hashes of instructions. They will be executed in order. Arrays and hashes may be nested at will. If the key in the instructions hash refers to a child Netzke component, netzkeBulkExecute will be called on that component with the value passed as the argument.

Example:

 // executes as this.feedback("Your order is accepted");
 {feedback: "You order is accepted"}

 // executes as: this.setTitle('Suprise!'); this.setDisabled(true);
 [{setTitle:'Suprise!'}, {setDisabled:true}]

 // executes as: this.netzkeGetComponent('users').netzkeBulkExecute([{setTitle:'Suprise!'}, {setDisabled:true}]);
 {users: [{setTitle:'Suprise!'}, {setDisabled:true}] }

netzkeChooseContainer

(
  • params
)

Decides, based on params passed to netzkeLoadComponent, what container the component should be loaded into.

Parameters:

  • params Object

    Object

netzkeEndpointUrl

(
  • endpoint
)

Returns a URL for old-fashion requests (used at multi-part form non-AJAX submissions).

Parameters:

  • endpoint String

netzkeEvalCss

(
  • code
)

Evaluates CSS passed from the server.

Parameters:

  • code String

    CSS code

netzkeEvalJs

(
  • code
)

Evaluates Javascript passed from the server.

Parameters:

  • code String

    Javascript code

netzkeGetComponent

(
  • path
)

Returns instantiated child component by its relative path

Parameters:

  • path String

    Component path, which may contain the 'parent' for walking up the hierarchy, e.g. parent__sibling. If this is empty, the method will return this.

netzkeGetDirectFunction

(
  • methodName
  • [config]
)

Returns direct function by endpoint name and optional component's config (if not provided, component's instance will be used instead)

Parameters:

  • methodName String
  • [config] Object optional

netzkeGetParentComponent

()

Returns parent Netzke component

netzkeHandleDirectError

(
  • callback
  • event
)

TODO

Parameters:

  • callback Function
  • event Object

netzkeHandleEndpointError

()

TODO

netzkeHandleLoadingError

()

Handles loading error

netzkeHandleLoadingResponse

()

Handles regular server response (may include error)

netzkeHideLoadingMask

()

Unmasks loading container

netzkeInstantiateComponent

(
  • name
)

Instantiates and returns a Netzke component by its name.

Parameters:

  • name String

    Child component's name/itemId

netzkeLoadComponent

(
  • name
  • [options]
)

Dynamically loads child Netzke component

Parameters:

  • name String

    Component name as declared in the Ruby class with component DSL

  • [options] Object optional

    May contain the following optional keys:

    • container {Ext.container.Container|Integer}

      The instance (or id) of a container with the "fit" layout where the loaded component will be added to; the previously existing component will be destroyed

    • append {Boolean}

      If set to true, do not clear the container before adding the loaded component

    • configOnly {Boolean}

      If set to true, do not instantiate/insert the component, instead pass its config to the callback function

    • serverConfig {Object}

      Config accessible inside the component DSL block as client_config; this allows reconfiguring child components by the client-side code

    • callback {Function}

      Function that gets called after the component is loaded; it receives the component's instance (or component config if configOnly is set) as parameter; if the function returns false, the loaded component will not be automatically inserted or (in case of window) shown.

    • scope {Object}

      Scope for the callback; defaults to the instance of the component.

Example:

Loads 'info' and adds it to this container, removing anything from it first:

this.netzkeLoadComponent('info');

Loads 'info' and adds it to win container, envoking a callback in this scope, passing it an instance of 'info':

this.netzkeLoadComponent('info', { container: win, callback: function(instance){} });

Loads configuration for the 'info' component, envoking a callback in this scope, passing it the loaded config for 'info'.

this.netzkeLoadComponent('info', { configOnly: true, callback: function(config){} });

Loads two 'info' instances in different containers and with different configurations:

this.netzkeLoadComponent('info', {
  container: 'tab1',
  serverConfig: { user: 'john' } // on the server: client_config[:user] == 'john'
});

this.netzkeLoadComponent('info', {
  container: 'tab2',
  serverConfig: { user: 'bill' } // on the server: client_config[:user] == 'bill'
});

netzkeNormalizeActions

(
  • config
)

Replaces actions configs with Ext.Action instances, assigning default handler to them

Parameters:

  • config Object

netzkeNormalizeConfig

(
  • config
)

Runs through initial config options and does the following:

  • detects component placeholders and replaces them with full component config found in netzkeComponents
  • detects action placeholders and replaces them with instances of Ext actions found in this.actions

Parameters:

  • config Object

netzkeNormalizeConfigArray

(
  • items
)
private

Processes items.

Parameters:

  • items Array

    Items

netzkeNotify

(
  • msg
  • options
)

Triggers a notification unless quiet config option is true.

Parameters:

  • msg String

    Notification body

  • options Object

    Notification options (such as title, delay)

netzkeProcessDeliveredComponent

()

Processes delivered component

netzkeProcessDirectResponse

(
  • response
  • event
  • callback
  • scope
)

TODO

Parameters:

  • response Object
  • event Object
  • callback Function
  • scope Object

netzkeProcessEndpoints

(
  • config
)

Dynamically creates methods for endpoints, so that we could later call them like: this.myEndpointMethod()

Parameters:

  • config Object

netzkeProcessPlugins

()

TODO

netzkeReload

()

Reloads itself by instructing the parent to call netzkeLoadComponent. Note: in order for this to work, the component must be nested in a container with the 'fit' layout.

netzkeReloadChild

(
  • child
  • serverConfig
)

Given child component and new serverConfig, reloads the component

Parameters:

  • child Object

    Netzke.Base

  • serverConfig Object

    Object

netzkeReplaceChild

(
  • child
  • config
)

Replaces given (Netzke or Ext JS) component and new config, replaces former with latter, by instructing the parent component to re-insert the component at the same index. Override if you need something more fancy (e.g. active tab when it gets re-inserted)

Parameters:

netzkeSessionExpired

() private

Called by the server when the component to which an endpoint call was directed to, is not in the session anymore.

netzkeSetResult

(
  • result
)
private

Called by the server side to set the return value of an endpoint call; to be reworked.

Parameters:

  • result Any

netzkeShowLoadingMask

()

Masks container in which a child component is being loaded

onSessionExpired

() private

Override this method to handle session expiration. E.g. you may want to inform the user that they will be redirected to the login page.

Properties

isNetzke

Boolean

This is true for all Netzke components.

netzkeNotifier

Netzke.Notifier

Override this property globally if you to use a custom notifier class.