Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/admin_templates/js/grid_filters.js
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | |||||
// set click handlers | // set click handlers | ||||
$('#_mutlioptions_cb_' + $cur_index + '_all') | $('#_mutlioptions_cb_' + $cur_index + '_all') | ||||
.click( | .click( | ||||
function ($e) { | function ($e) { | ||||
MultiOptions.SelectAll($cur_index); | MultiOptions.SelectAll($cur_index); | ||||
} | } | ||||
) | ) | ||||
.prop('checked', $options.length == $options.filter(':selected').length > 0); | .prop('checked', $options.length == $options.filter(':selected').length); | ||||
$('input._mutlioptions_cb_' + $cur_index).click( | $('input._mutlioptions_cb_' + $cur_index).click( | ||||
function ($e) { | function ($e) { | ||||
MultiOptions.ItemChecked($cur_index); | MultiOptions.ItemChecked($cur_index); | ||||
} | } | ||||
); | ); | ||||
// add filter placeholder, used for filter opening filter | // add filter placeholder, used for filter opening filter | ||||
Show All 32 Lines | |||||
// sync hidden field | // sync hidden field | ||||
var $reg_exp = new RegExp('^_mutlioptions_cb_' + selector_index + '_(?!all)([0-9A-Za-z-]+)'); | var $reg_exp = new RegExp('^_mutlioptions_cb_' + selector_index + '_(?!all)([0-9A-Za-z-]+)'); | ||||
update_checkbox_options($reg_exp, MultiOptions.Selectors[selector_index]); | update_checkbox_options($reg_exp, MultiOptions.Selectors[selector_index]); | ||||
// update "Select All" checkbox | // update "Select All" checkbox | ||||
var $select_all = $('#_mutlioptions_cb_' + selector_index + '_all'); | var $select_all = $('#_mutlioptions_cb_' + selector_index + '_all'); | ||||
var $options = $("input[type='checkbox']", '#' + jq(MultiOptions.Selectors[selector_index]) + '_div').not($select_all); | var $options = $("input[type='checkbox']", '#' + jq(MultiOptions.Selectors[selector_index]) + '_div').not($select_all); | ||||
$select_all.prop('checked', $options.length == $options.filter(':checked').length > 0); | $select_all.prop('checked', $options.length == $options.filter(':checked').length); | ||||
} | } | ||||
MultiOptions.SelectAll = function(selector_index) { | MultiOptions.SelectAll = function(selector_index) { | ||||
// set all checkbox to match "Select All" checkbox | // set all checkbox to match "Select All" checkbox | ||||
var $select_all = $('#_mutlioptions_cb_' + selector_index + '_all'); | var $select_all = $('#_mutlioptions_cb_' + selector_index + '_all'); | ||||
var $checked = $select_all.prop('checked'); | var $checked = $select_all.prop('checked'); | ||||
$("input[type='checkbox']", '#' + jq(MultiOptions.Selectors[selector_index]) + '_div').not($select_all).prop('checked', $checked); | $("input[type='checkbox']", '#' + jq(MultiOptions.Selectors[selector_index]) + '_div').not($select_all).prop('checked', $checked); | ||||
// sync hidden field | // sync hidden field | ||||
var $reg_exp = new RegExp('^_mutlioptions_cb_' + selector_index + '_(?!all)([0-9A-Za-z-]+)'); | var $reg_exp = new RegExp('^_mutlioptions_cb_' + selector_index + '_(?!all)([0-9A-Za-z-]+)'); | ||||
update_checkbox_options($reg_exp, MultiOptions.Selectors[selector_index]); | update_checkbox_options($reg_exp, MultiOptions.Selectors[selector_index]); | ||||
} | } |