Behaviors: ObjectBind

The ObjectBind behavior is used to bind an HTML element to some dynamically generated content. It is the most commonly used method for fetching data via AJAX from QBO 3. 

Examples include:

Render a Decision Search panel:

<div id="search" class="tab-pane" data-behavior="ObjectBind" data-objectbind-options="{{ 'class': 'qbo3.DecisionObject', 'method': 'Search', 'render': false, 'listen': ['search'], 'cacheKey': 'Decision.Home.Search' }}">.</div>

Render a Contact Select panel:

<div id="select" class="span12" data-behavior="ObjectBind" data-objectbind-options="{{ 'class': 'qbo3.ContactObject', 'method': 'Select', 'remember': false, 'data': {{'ID': '{ContactID}' }} }}">.</div>

Render a Smart Worklist Dashboard:

<div data-behavior="ObjectBind" data-objectbind-options="{{ 'class': 'qbo3.SmartWorklistMemberObject', 'cacheKey': 'SmartWorklistHome-Current', 'method': 'Dashboard', 'listen': ['refreshAll'], 'data': {{'Dimension': 'SmartWorklistID', 'Transform': 'SmartWorklistMember.Dashboard.xslt', 'SortBy': 'SmartWorklist'}} }}">.</div>

The key ObjectBind options include:
  • class: (required) name of the qbo3.AbstractObject-derived class to use to render the data
  • method: the name of the method or operation to execute when rendering the data
  • data: parameters to pass to the server when making the AJAX call
  • render: (defaults to true) whether to invoke the class/method immediately (if false, the panel will 'wait' for some other javascript event to cause the panel to make the AJAX call)
  • listen: an array of events to listen for on the behavior api; when any of these events are raised, the panel will make an AJAX call
  • remember: (defaults to true) whether to cache the panel's content in local storage, so when the user revisits the page, the content is fetched from disk instead of over the wire
  • cacheKey: name of the key to store the panel's content as
  • maxCacheDuration: maximum length content may remain in cache; once this time is exceeded, the cached content will be ignored and refreshed from the server
In the examples above:
  • The Decision Search panel will call the URL Decision/Decision.ashx/Search
  • The Contact Select panel will call the URL Contact/Contact.ashx/Select?ID={some ContactID}
  • The Smart Worklist Dashboard panel will call the URL Decision/SmartWorklistMember.ashx/Dashboard?Dimension=SmartWorklistID&Transform=SmartWorklistMember.Dashboard.xslt&SortBy=SmartWorklist
Note that the ObjectBind behavior does not dictate what is in the data option; this depends on the method/operation being called.