If you are seeing this message it is likely that the master layout is unavailable. Please contact helpdesk and raise a support case.

Ajax actionTip

TipMenu

Now with added tooltips!

This example enables you to test the ajax UI functionality.
Entering anything into the text box will be passed to the backend and returned via Ajax into the partial.

A delay of five seconds has been inserted after you click so you can see the appropriate loading UI.

Actions

Your Ajax result will show here

InteractionsTip

TipMenu

Now with added tooltips!

Accordion

This example shows the expanding and collapsing of hidden information.

The functionality of accordions is accessed by calling AccordionAction(AccordionContainerElement); within the $(document).ready(function () {…});.

AccordionContainerElement is optional (technically it's not optional but you can pass an empty string). In this case AccordionAction will act on any accordion HTML code on the page.

ExpanderAccordion A Accordion A

Accordion content A here.

ExpanderAccordion B Accordion B

Accordion content B here.

view codeSample HTML code
<div class="fullWidth" id="Accordion1">
    <div class="accordionHeader">
        <span class="icon32 icon-expand32">Expander</span><abbr class="icon32 icon-results32">Accordion
            A</abbr>
        Accordion A
    </div>
    <div class="accordionContent">
        <p>
            Accordion content A here.</p>
    </div>
</div>
<div class="fullWidth" id="Accordion2">
    <div class="accordionHeader">
        <span class="icon32 icon-expand32">Expander</span><abbr class="icon32 icon-results32">Accordion
            B</abbr>
        Accordion B
    </div>
    <div class="accordionContent">
        <p>
            Accordion content B here.</p>
    </div>
</div>

When an accordion is loaded via Ajax AccordionAction(AccordionContainerElement); must be called from within the loaded code.

Ajax accordions

Your Accordion content will show here

Alternative layout

In some instances the title information will crowd the accordion header. In these instances the text content should be wrapped in span elements using the sml class.

ExpanderAccordion header Accordion header £999.99 [New] [Client]

Accordion content.

Layer revealing

Each of the icons to the right contain the class outcomeChoice which when clicked closes any existing open outcomePanel and then opened the requested outcodePanel and expands the associated accordionContent.

This accordion setup can be used alongside other accordion items without interrupting each other as shown in this example.

expanderCustomer Customer

[Customer info here]

expanderNo contact No contact

[No contact form here]

expanderCall back request Call back request

[Call back request form here]

expanderRefer back to client Refer back to client

[Refer back to agent form here]

expanderQuote Quote

[Quote information here]

expanderNon-proceed Non-proceed

[Non-proceed form here]

expanderRecall customer Recall customer

[Recall customer form here]

expanderRecall client Recall client

[Recall client form here]

expanderCancel client contact Cancel client contact

[Non-proceed form here]

view codeSample HTML code
<div class="outcomePanel fullWidth" id="Cancelclientcontact">
    <div class="accordionHeader">
        <span class="icon32 icon-expand32">expander</span><abbr class="icon32 icon-taskOutcome8-32">Cancel
            client contact</abbr>
        Cancel client contact
    </div>
    <div class="accordionContent">
        <p>
            Non-proceed form here</p>
    </div>
</div>
view codeSample jQuery code
//call each outcome as requested
$('.outcomeChoice').click(function (){
        
    //identify the specif outcome requested. Hide all panels and show the panel requested
    $('.outcomePanel').slideUp({
	                duration: 467, 
	                easing: 'easeInExpo'});
    $('#' + $(this).attr('rel') + ' .accordionContent').show();
    $('#' + $(this).attr('rel') + ' .accordionHeader span').next('span').removeClass('icon-expand32').addClass('icon-contract32');
    $('#' + $(this).attr('rel')).slideDown({
	                duration: 962, 
	                easing: 'easeInOutQuart'});

});

Reordering (aka Sortable)

Sorting uses a plugin that extends the jQuery UI sortable called NestedSortable function. This is used for single and nested hierarchies.

The jQuery call $('ol.sortable').nestedSortable({…}); from within $(document).ready(function () {…});

Notifications of system responses will appear as tabs above the area of interaction in a div with the class .updateNotifier as shown here:

Loading... loading
Change successful.
An error occurred!
  1. EditManageDeleteItem 1
    Item description
  2. EditManageDeleteItem 2
    Item description
  3. EditManageDeleteItem 3
    Item description
  4. EditManageDeleteItem 4
    Item description
view codeSample HTML code
<ol class="sortable">
    <li rel="1"><span>
        <var class="right">
            <a href="#" class="icon32 icon-edit32" title="Edit">Edit</a><a href="#" class="icon32 icon-manage32"
                title="Manage">Manage</a><a href="#" class="icon32 icon-remove32" title="Delete">Delete</a></var><var
                    class="icon32 icon-hand32"></var><b>Item 1</b><br />
        Item description</span></li>
    <li rel="2"><span>
        <var class="right">
            <a href="#" class="icon32 icon-edit32" title="Edit">Edit</a><a href="#" class="icon32 icon-manage32"
                title="Manage">Manage</a><a href="#" class="icon32 icon-remove32" title="Delete">Delete</a></var><var
                    class="icon32 icon-hand32"></var><b>Item 2</b><br />
        Item description</span></li>
</ol>
view codeSample jQuery code
$('ol.sortable').nestedSortable({
	forcePlaceholderSize: true,
	handle: 'span',
	helper:	'clone',
	items: 'li',
	opacity: .6,
	placeholder: 'placeholder',
	revert: 250,
	tabSize: 25,
	tolerance: 'pointer',
	toleranceElement: '> span',
	maxLevels: 0,
	isTree: true,
	expandOnHover: 700,
	startCollapsed: true
});

Hierarchy

The full functionality of this section consists of the following:

Nesting
Sortable
Expand/Collapse levels
Removable candidates
Adding candidates
Display expanded accordion information

  1. Expander EditManageCopyAddDeleteItem 1
    Item description (id = 1)
    1. Expander EditManageCopyAddDeleteItem 1.1
      Item description (id = 2)
      1. Expander EditManageCopyAddDeleteItem 1.1.1
        Item description (id = 3)
        1. Office i
        2. Office ii
        3. Office iii
    2. Expander EditManageCopyAddDeleteItem 1.2
      Item description (id = 4)
  2. Expander EditManageCopyAddDeleteItem 2
    Item description (id = 5)
  3. Expander EditManageCopyAddDeleteItem 3
    Item description (id = 6)
    1. Expander EditManageCopyAddDeleteItem 3.1
      Item description (id = 7)

Nesting

Use nested <ol> elements to create the indented style.

Sortable

Add the class sortable to the parent <ol> which is used to fire the nestedSortable jQuery UI plugin extension the same as used for a non-nested collection; calling $('ol.sortable').nestedSortable({…}); from within $(document).ready(function () {…});.

Expand/collapse levels

Similar to AccordionAction() in functionality, to make nested levels expand and collapse on demand add <var class="icon32 icon-contract32 expander">Expander</var> immediately after the first <span> element in each <li>. This will be picked up by a jQuery call within $(document).ready(function () {…});.

view codeSample jQuery code
//Expand/collapse functionality for nested sortable (hierarchy)
$('.sortable .expander').click(function(){
        
    $(this).parent().nextAll('ol').slideToggle();

    currentClass = $(this).attr('class');

    newClass = currentClass == 'icon32 icon-expand32 expander' ? 'icon32 icon-contract32 expander' : 'icon32 icon-expand32 expander'
            
    $(this).removeClass(currentClass).addClass(newClass);
});

Removable candidates

The final nested <ol> used for the removable candidates requires the class finalLevel added and is displayed at a reduced height with checkboxes.

The checkbox ids are used as the unique identifier for each candidate and contain the class candidateRemoval.

view codeSample HTML code
<ol class="finalLevel">
    <li><span>
        <input class="candidateRemoval" id="1" type="checkbox" />
        <var class="icon16 icon-hand16">
        </var>
        <strong>Office i</strong></span> </li>
    <li><span>
        <input class="candidateRemoval" id="2" type="checkbox" />
        <var class="icon16 icon-hand16">
        </var>
        <strong>Office ii</strong></span> </li>
    <li><span>
        <input class="candidateRemoval" id="3" type="checkbox" />
        <var class="icon16 icon-hand16">
        </var>
        <strong>Office iii</strong></span> </li>
</ol>

Clicking the 'Remove item(s)' button with the id #RemoveCandidatesBtn will fire a click event iterating through all checkboxes with the class candidateRemoval, build a comma separated string ready for posting to a backend method.

view codeSample jQuery code
$('#RemoveCandidatesBtn').click(function(){
        
    //create var to hold checked item array
    var arrToRemove = '';

    //iterate through all cechboxes on page and collect IDs
    $('.candidateRemoval').each(function(){

        //add checked item to array
        if($(this).attr('checked') == true){

            arrToRemove = arrToRemove + $(this).attr('id') +',';
                
        }
            
    });

    //finally, remove any trailing comma
    if(arrToRemove > ''){
            
        arrToRemove = arrToRemove.substring(0, arrToRemove.length - 1)
            
    }

    alert('Array of IDs checked: ' + arrToRemove);
        
});

Adding candidates

Documentation for this feature is within the 'Add candidates' RH tab.

Display expanded accordion information

In the requirement to display more information about a given level add a block element with the class .generalMessage and style="display:none;" (this is assumming the default position is closed).

The toggle is triggered by a click event on an element containing the class showHideContent.

The content of this element can be any HTML you require. This example has accordions with table data.

  1. Expander InfoEditManageCopyAddDeleteItem 1
    Item description
    1. Expander InfoEditManageCopyAddDeleteItem 1.1
      Item description
view codeSample HTML code
<ol class="sortable">
    <li><span>
        <var class="right">
            <a class="icon32 icon-info32 showHideContent" title="Toggle info">Info</a></var><b>Item 1</b><br />
        Item description</span>
        <div class="generalMessage" style="display: none;">
            ####Expanded element content here####
        </div>
    </li>
</ol>
view codeSample jQuery code
$('.showHideContent').click(function(){
        
    $(this).parent().parent().siblings('.generalMessage').slideToggle();
        
});

Nested choices

The basic UI structure is simple set of nested <ol> elements.

The example below shows items with and without associated items. Where an association already exists, the item checkbox will be unavailable until the associated item is unchecked.

  1. Item 1 (id = 1)set item A (id = 10)
  2. Item 2 (id = 2)set item B (id = 11)
    1. Item 2.1 (id = 3)
    2. Item 2.2 (id = 4)
      1. Item 2.2.1 (id = 5)set item C (id = 12)
      2. Item 2.2.2 (id = 6)
  3. Item 3 (id = 7)
    1. Item 3.1 (id = 8)
Actions

For the jQuery to manipulate the checkbox availability appropriately the checkboxes must have the classes .userParentItem and .userAssoc respectively.

view codeSample HTML code
<ol>
    <li><span>
        <input type="checkbox" disabled="disabled" class="userParentItem" />Item 1 <em>set item A
        <input type="checkbox" class="userAssoc" checked="checked" /></em></span>
    </li>
</ol>

A click event on either of these will fire the appropriate jQuery method.

view codeSample jQuery code
$('.userAssoc').change(function(){
        
    if($(this).attr('checked')){

        $(this).parent().prev('input').attr('disabled','disabled');

    }else{

        $(this).parent().prev('input').removeAttr('disabled');

    }
        
});

$('.userParentItem').change(function(){
        
    if($(this).attr('checked')){

        $(this).next().children('input').attr('disabled','disabled');

    }else{

        $(this).next().children('input').removeAttr('disabled');

    }
        
});

Posting data back to the server

Due to the dynamic nature of nested choices it is impractical to post all rendered checkbox form fields to the server. Instead changes to each checkbox fire a jquery change event and are stored as a key/value pair array to a hidden field with the id #hdnNestedChoices which can be posted back to the server for processing before updating the view.

view codeSample jQuery code
//collect up all the user checking and unchecking ready for posting to the server
$('.userParentItem, .userAssoc').change(function(){
        
    //Get the value of the changed item
    var changedID = $(this).val();
    //get the status of the changed item
    var changedValue;
    if($(this).attr('checked')){
        changedValue = 1;
    }else{
        changedValue = 0;
    }
            
    //update the hidden field
    var hdnArray = $('#hdnNestedChoices').val();
    hdnArray = hdnArray + changedID + ',' + changedValue + '|'; 
    $('#hdnNestedChoices').val(hdnArray);
});

Clicking 'update' fires a jquery click event which checks to see if any changes have been made and if so, tidies the hidden field value ready for posting.

For demonstration purposes the hidden field value is displayed in an alert when 'update' is clicked.

view codeSample jQuery code
//Send the array
$('#btnUpdateChoices').click(function(){
        
    var anythingToSend = $('#hdnNestedChoices').val();
    //has the user made any changes
    if(anythingToSend > ''){
        //Remove the trailing pipe
        anythingToSend = anythingToSend.substring(0, anythingToSend.length - 1);
        alert('String sent to server: ' + anythingToSend);
    }else{
        alert('Nothing to post');
    }
});

Teleportation boxes

This is a system for being able to move several items from one list to another.

The multi-select input elements are placed with a table with the class teleportationBoxes.

Add Del
view codeSample HTML code
<table class="teleportationBoxes">
    <tr>
        <td>
            <div class="editor-label">
                <label for="LenderCompany">
                    Available lender company</label></div>
            <div class="editor-field">
                <select id="TargetItemStart" multiple="multiple" name="LenderCompany">
                    <option value="50">Peter Lending Agency</option>
                    <option value="51">Tom Lending Agency</option>
                    <option value="52">Jones Lending Agency</option>
                </select>
            </div>
        </td>
        <td style="width:32px;">
            <span id="addItem" class="icon32 icon-moveRight32">Add</span> <span id="delItem" class="icon32 icon-moveLeft32">Del</span>
        </td>
        <td>
            <div class="editor-label">
                <label for="LenderCompany">
                    Assoc. lender company</label></div>
            <div class="editor-field">
                <select id="TargetItemEnd" multiple="multiple" name="LenderSupplier">
                    <option value="53">Kim Lenders</option>
                </select>
            </div>
        </td>
    </tr>
</table>

The script function is fired on the Add or Del click events within the $(document).ready(function () {…});.

view codeSample jQuery code
//teleportation boxes add
$('#addItem').click(function() {
    teleportationBoxes('#TargetItemStart', '#TargetItemEnd', '#SelectedTargetItems');
});
//teleportation boxes remove
$('#delItem').click(function() {
    teleportationBoxes('#TargetItemEnd', '#TargetItemStart', '#SelectedTargetItems');
});

Ajax functions

Many MWU sites now use Ajax extensively. In order to simplify re-use of code there are several jQuery functions available to accomodate the types of calls used:

AjaxFormPost
AjaxAction

AjaxFormPost

For submit actions use the AjaxFormPost(selector,target); function call inside the $(document).ready(function () {...});

In this example the form ID is AjaxPostExample and the resulting data is targetted at <div id="AjaxPostResultSample">

view codeSample jQuery code
//Posting a form via jQuery Ajax from the main pane
$('#AjaxPostExample').submit(function(){
    //Pass in "this" (the form as a jQuery object) and the target element
    AjaxFormPost($(this),'#AjaxPostResultSample');
    return false;
});

Actions

Your Ajax result will show here

AjaxAction

For GET actions, including GET actions that require being sent via the POST method (such as actions that amend a db but can be presented to the server via querystring)

Call the AjaxAction(e,selector,target,optional request type,optional final action); function via a jquery submit or click method inside the $(document).ready(function () {...});

Arguments:

e: event object
action: request address
target: element on page assigned to recieve requested address response
requestType: optional string. 'GET' by default can be set to 'POST'
finalAction: optional string. On some pages there may be multiple accordions that need closing. e.g. 'SlideUp' is required if the accordion is to close

In this GET example the hyperlink ID is AjaxGETActionLink and the resulting URL/action result is targetted at <div id="AjaxGETResultSample">

Make sure e has been declared as an argument in the calling event function; such as $('#AjaxGETActionLink').click(function(e){...});

view codeSample jQuery code
//Hyperlink using jQuery Ajax from the main pane
$('#AjaxGETActionLink').click(function(e){
    AjaxAction(e, $(this).attr('href'),'#AjaxGETResultSample');
});

Ajax me a link

Your Ajax result will show here

TooltipsTip

TipTooltips

This is a HTML tooltip!

There are two types of tooltips available in the system; Title tooltips and HTML tooltips.

All tooltips are part of the jQuery Tools plugin.

All tooltips require a call to the tooltips(''); function within the $(document).ready(function () {…});.

Title tooltips

Title tooltips are used for quick reference information such as the descriptive label on a save icon. They are small and limited to a fixed size.

Title tooltips are automatically actioned on any element containing the title HTML attribute. For example purposes we have given the view icon title="This is a tooltip!" which can be seen when you hover over the icon.

view codeSample HTML code
<span class="icon32 icon-eye32 codeViewer" style="vertical-align: middle;" title="This is a tooltip!">view code</span>

HTML tooltips

In the case where more information and richer content is required within the tooltip HTML tooltip is available.

This varies from the Title tooltip in that HTML code is required immediately after the calling element. The calling element requires the class launchHTMLtooltip and the tooltip element requires the class HTMLtooltip.

For example purposes the following view icon contains the class launchHTMLtooltip followed by the tooltip element with the class HTMLtooltip.

view codeSample HTML code

TipTooltips

This is HTML in a tooltip!

<h5><span class="icon32 icon-eye32 codeViewer launchHTMLtooltip" style="vertical-align: middle;">view code</span>Sample html code</h5>
    <div class="HTMLtooltip ui-corner-all shadow">
        <h2>
            <span class="icon32 icon-Lightbulb32 right">Tip</span>Tooltips</h2>
        <p>[Tooltip content]</p>
    </div>

Add candidatesTip

TipAdd Offices

Now with added tooltips!

After choosing a level radio button from the hierarchy tab, select the offices you wish to add and click add.

Actions

Adding is done via a standard form using jQuery to populate a hidden field hdnTargetLevel with the target item ID.

Until a target radio button with the class .rbHierarchy is selected a faux button is displayed.

view codeSample HTML code
<div class="editor-field">
    <input type="button" class="button" id="AddCandidateRestriction" value="Choose hierarchy first" />
    <input type="submit" value="Add" class="button" style="display: none;" id="AddCandidate" />
</div>

Choosing a target radio button with the class .rbHierarchy fires a jQuery change event.

view codeSample jQuery code
//Only show candidate submit if a target level has been chosen
$('.rbHierarchy').change(function(){
        
    $('#AddCandidateRestriction').hide();
    $('#AddCandidate').show();
        
});

On submission of the AddCandidateForm form, a jQuery submit event fires populating the hidden field hdnTargetLevel. For illustration purposes an alert has been added to display the information ready to be posted back to the server.

view codeSample jQuery code
//get together the info needed to be posted back to update the hierarchy
$('#AddCandidateForm').submit(function(){
        
    //get the target value
    var targetLevel = $('.rbHierarchy:checked').val();
    //pass it into a hidden field
    $('#hdnTargetLevel').val(targetLevel);

    //get the ids of the cadiates to be added
    var candidates = $('#AddCandidateDropdown').val();

    alert('The system will post candidates: ' + candidates + ' to target item id: ' + targetLevel);

    return false;
        
});