Client Side API

MatchPoint provides a set of JavaScript objects and functions that can be used within the MatchPoint configuration files (e.g. within the Composite Web Part) as well as within custom controls and Web Parts.

The following functionality is available:

JS Method/-Class Functionality
$$.Invoke, $$.Eval Allows evaluating MatchPoint expression engine within a JS call.
MP.OfficeTemplate.Open Allows opening MS Word documents and use the expression engine.
MP.ConnectionManager.SetData
MP.ConnectionManager.NotifyConsumers
MP.ConnectionManager.NotifyBehavior
Provides methods for making data available for the connection framework and for notifying consumers.
$$.WaitForBehaviors, $$.RefreshControl Allows controlling the loading behavior of components.
$$.PopupMenu.Clear
$$.PopupMenu.Show
$$.PopupMenu.IsVisible
$$.PopupMenu.Add
Allows creating and modifying a popup menu.
$$.Opener... Provides functions to open dialogs.
Client Side API overview

Evaluating Expressions

In most cases, expressions will be evaluated when the configuration file is loaded, e.g. users access a Web Part page where a MatchPoint Web Part is configured with an expression. If an expressions need to be evaluated client-side within a JavaScript call, MatchPoint provides two methods $$.Eval('') and $$.Invoke('', , , ...).

var filename = 'http://sps/Documents/KeyPerformanceIndicators.ppt';
$$.InvokeMethod('SPHelper.GetUniqueFileName', filename);

$$ object provides functionality to display popup menus in custom controls.

The following functions are available:

Method Functionality
Add(innerHtml, iconUrl, onClick, disabled) Adds a new menu item with the specified HTML, icon, onClick event handler and disabled state. Separator items can be defined by setting the innerHtml parameter to "-".
Show(anchor, alignRight, dummy, popupPanel, highlightElem, delta) Displays the popup menu at the specified anchor DOM element.
PositionPopup(delta) Repositions the visible popup menu according to the specified delta values (delta.X, delta.Y)
Clear() Removes all menu items from this popup menu.
Hide() Hides the popup menu.
HasItems() Returns a boolean whether the popup menu has menu items.
IsVisible() Returns a boolean whether the popup menu is visible.
$$.PopupMenu.HideActivePopup() Hides the active singleton instance of the popup menu.
Popup menu functions

Controlling Loading Behavior

MatchPoint offers some client side functions which allows interacting with controls.

$$.WaitForBehaviors(function)

This function can be used to register a custom function, which is executed when all behaviors of the MatchPoint controls are loaded and initialized. This is useful when custom client side code needs to interact with a MatchPoint control.

$$.RefreshControl(src)

This function will refresh the MatchPoint control that is specified by the parameter. The parameter is a DOM element representing the MatchPoint control itself or a DOM element, which is contained within the MatchPoint control.

Using jQuery

MatchPoint 4 uses jQuery version 1.8.3.

In MatchPoint jQuery is registered on the global variable mp$. This is what MatchPoint internally uses, thus making it independent of the global $ and jQuery variables.

Additionally the MatchPointConfiguration offers a property named RegisterJQueryGlobally:

  • If this property is selected (which is the default case), the jQuery version will be referenced by the jQuery and the $ variables. This is the normal, downward-compatibility behavior of MatchPoint.
  • If this property is not selected, MatchPoint will execute jQuery.noConflict() after loading the MatchPoint JavaScript files. The global jQuery variables will then be unassigned. This can be used for example to force the developers to use their own jQuery and thus be independent of the MatchPoint version.

Summarized this means that you can always use the mp$ variable to work with the jQuery version from matchpoint and if the RegisterJQueryGlobally property is selected you can also use the jQuery and the $ variables.

More detailed information about using a different versions of jQuery can be found in this blog post.

results matching ""

    No results matching ""