Add empty type to triggerapi
This commit is contained in:
parent
bdb3d5ff45
commit
a4379e89b1
|
|
@ -1,22 +1,22 @@
|
|||
/*
|
||||
* The trigger API.
|
||||
*
|
||||
* The API allows to change elements' visibility or status (enabled/disabled) basing on
|
||||
* The API allows to change elements' visibility or status (enabled/disabled) basing on
|
||||
* other elements' statuses. Example: enable a button if any checkbox inside another
|
||||
* element is checked.
|
||||
*
|
||||
* Supported data attributes:
|
||||
* - data-trigger-type, values: display, hide, enable, disable
|
||||
* - data-trigger-type, values: display, hide, enable, disable, empty
|
||||
* - data-trigger: a CSS selector for elements that trigger the action (checkboxes)
|
||||
* - data-trigger-condition, values:
|
||||
* - data-trigger-condition, values:
|
||||
* - checked: determines the condition the elements specified in the data-trigger
|
||||
* should satisfy in order the condition to be considered as "true".
|
||||
* - value[somevalue]: determines if the value of data-trigger equals the specified value (somevalue)
|
||||
* the condition is considered "true".
|
||||
*
|
||||
* Example: <input type="button" class="btn disabled"
|
||||
* Example: <input type="button" class="btn disabled"
|
||||
* data-trigger-type="enable"
|
||||
* data-trigger="#cblist input[type=checkbox]"
|
||||
* data-trigger="#cblist input[type=checkbox]"
|
||||
* data-trigger-condition="checked" ... >
|
||||
*
|
||||
* Supported events:
|
||||
|
|
@ -83,6 +83,8 @@
|
|||
this.$el.prop('disabled', !status).trigger('disable', [!status]).toggleClass('control-disabled', !status)
|
||||
else if (this.options.triggerType == 'disable')
|
||||
this.$el.prop('disabled', status).trigger('disable', [status]).toggleClass('control-disabled', status)
|
||||
else if (this.options.triggerType == 'empty' && status)
|
||||
this.$el.trigger('empty').val('')
|
||||
|
||||
if (this.options.triggerType == 'display' || this.options.triggerType == 'hide')
|
||||
this.fixButtonClasses()
|
||||
|
|
|
|||
Loading…
Reference in New Issue