mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-26 05:42:13 +09:00
17523934 * XE.setCheckedAll() 인수 변경
* clickCheckBoxAll() 대체하기 위함 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5048 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aca1266b33
commit
6f1f831dda
1 changed files with 12 additions and 10 deletions
|
|
@ -15,34 +15,36 @@ if(jQuery) jQuery.noConflict();
|
|||
window.XE = {
|
||||
/**
|
||||
* @brief 특정 name을 가진 체크박스들의 checked 속성 변경
|
||||
* @param [itemName='cart' [,checked=true]] | [checked]
|
||||
* @param [itemName='cart',][options={checked:true, doClick:false}]
|
||||
*/
|
||||
setCheckedAll : function() {
|
||||
var itemName='cart', checked=true;
|
||||
var itemName='cart', options={checked:true, doClick:false};
|
||||
|
||||
switch(arguments.length) {
|
||||
case 1:
|
||||
if(typeof(arguments[0]) == "string" && arguments[0] != 'toggle') {
|
||||
if(typeof(arguments[0]) == "string") {
|
||||
itemName = arguments[0];
|
||||
} else {
|
||||
checked = arguments[0];
|
||||
options = $.extend(options, arguments[0] || {});
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
itemName = arguments[0];
|
||||
checked = arguments[1];
|
||||
options = $.extend(options, arguments[1] || {});
|
||||
}
|
||||
|
||||
if(checked == 'toggle') {
|
||||
$('[name='+itemName+']').each(function() {
|
||||
var obj = $('[name='+itemName+']');
|
||||
|
||||
if(options.checked == 'toggle') {
|
||||
obj.each(function() {
|
||||
if($(this).attr('checked')) {
|
||||
$(this).attr('checked', false);
|
||||
(options.doClick == true) ? $(this).click() : $(this).attr('checked', false);
|
||||
} else {
|
||||
$(this).attr('checked', true);
|
||||
(options.doClick == true) ? $(this).click() : $(this).attr('checked', true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('[name='+itemName+']').attr('checked', checked);
|
||||
(options.doClick == true) ? obj.click() : obj.attr('checked', options.checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue