Class: CheckboxModal

js-whatever/js/checkbox-modal. CheckboxModal

new CheckboxModal(init)

Bootstrap modal which displays tables containing checkboxes or radio buttons, which can be toggled individually or
through a global checkbox

Parameters:
Name Type Description
init CheckboxModalOptions
Source:
Example
new CheckboxModal({
    i18n: i18n,
    vent: vent,
    parameters: {
        modalHeader: 'modalHeader'
    },
    tables: [{
        initialState: true,
        tableHeader: 'tableTitle',
        rows: [
            'one',
            'two',
            'three'
        ]
    }]
});

Extends

  • Backbone.View

Methods

clearAllCheckboxes()

clear all checkboxes in all tables

Source:

<protected> clearAllRows()

Clear the internal state of all rows for all tables

Source:

getElementValue(selector) → {*}

Get the value of an input. Don't use this to get the value of checkboxes or you will have a bad time

Parameters:
Name Type Description
selector string

A css selector for locating the input

Source:
Returns:

The value of the input

Type
*

<protected> getModalTemplateParams() → {CheckboxModalTemplateParameters}

Gets the parameters which are passed to templateModal. The tables configs are passed to each table.

Source:
Returns:

template parameters augemented with the additional parameters
passed to initialize

Type
CheckboxModalTemplateParameters

getSelectedRows() → {Array.<string>}

Get the selected rows for each table. Updates the internal state of the tables

Source:
Returns:

The names of the selected rows

Type
Array.<string>

<protected> handleCheckBoxChange(e)

Handler called when a checkbox is clicked. This will set the state of the corresponding global checkbox
accordingly

Parameters:
Name Type Description
e object

jQuery event object

Source:

hideModal()

Hides the modal

Source:

<protected> onOkClick()

Called when the OK button is pressed. This will call okCallback and close the modal

Source:

remove()

removes the modal

Source:

render()

renders the modal and adds the event handlers

Source:
Returns:

this

<protected> resizeModal()

Called when the vent fires a vent:resize event. Sets the max-height of the modal body to 80% of the window
height, less the height of the modal-header and modal-footer, clamped to [1, 400].

Source:

<protected> restorePrevState()

Restores the previous state of the modal

Source:

setCheckbox(index, rowName, value)

Set the checked property of the named checkbox in the given table

Parameters:
Name Type Description
index number

The index of the table

rowName string

The name of the row

value boolean

The new value of the checkbox

Source:

setCheckboxes(index, value)

Set the checked property of all checkboxes in the given table

Parameters:
Name Type Description
index number

The index of the table

value boolean

The new value of the checkbox

Source:

setCheckboxesAndRows(index, valueCheckbox, valueGlobalCheckbox)

Sets the internal state and the checkboxes for a given table

Parameters:
Name Type Description
index number

The index of the table

valueCheckbox boolean

The new value of the checkbox

valueGlobalCheckbox boolean

The new indeterminate state of the global checkbox

Source:

setElementValue(selector, value)

Get the value of an input. Don't use this to get the value of checkboxes or you will have a bad time

Parameters:
Name Type Description
selector string

A css selector for locating the input

value *

The new value of the input

Source:

setGlobalCheckboxes()

sets the value of the global checkbox in each table in accordance with the values of the checkboxes in
the table

Source:

setIndeterminateCheckbox(index, value)

Sets the value of the indeterminate property of the checkbox with the given index

Parameters:
Name Type Description
index number

The index of the checkbox

value boolean

The value of the indeterminate property

Source:

setNthCheckbox(index, n, value)

Set the checked property of the nth input in the given table

Parameters:
Name Type Description
index number

The index of the table

n number

The index of the checkbox in the table. This includes the global checkbox and other inputs.

value boolean

The new value of the checkbox

Deprecated:
  • Prefer setCheckbox
Source:

<protected> setRow(index, name, value)

Sets the internal state of a row

Parameters:
Name Type Description
index number

The index of the table

name string

The name of the row

value boolean

The new value of the checkbox

Source:

<protected> setRows(index, value)

Sets the internal state of all rows for the given table

Parameters:
Name Type Description
index number

The index of the table

value boolean

The new value of the checkbox

Source:

<protected> setTableInitialState()

Initialises the internal state of the tables from the configuration

Source:

showModal()

Shows the modal

Source:
Copyright 2013-2018 Micro Focus International plc. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
Documentation generated by JSDoc 3.4.3 on Thu Jun 21st 18:04 2018 using the DocStrap template.