2011. 12. 9. 11:15

jquery 관련 (메모)

1. jquery ui dialog 기본값 설정 방법
$.extend($.ui.dialog.prototype.options, {
show: "blind",
        hide: "explode",
        width: 300,
        height: 230,
        resizable: false,
        position: [x, y],
        zIndex: 10000,
        buttons: {
        '닫기' : function() {
                $(this).dialog('close');
            }
        }
}); 

2. jquery ui dialog 모든 창 닫기 
$(".ui-dialog-content").dialog("close"); 

3. jquery ui datepicker 창을 아래쪽으로만 뜨게하기
$.extend($.datepicker,{_checkOffset:function(inst,offset,isFixed){return offset}});

4. jquery ui autocomplete 항목조절
$('#CompanyName').autocomplete(...)..data('autocomplete')._renderItem = function(ul, item) {
    //여기에 조건을 주고 모양을 설정해주면 됨
    if(item.value === '') {
        return $('<li class="ui-menu-item disabled" style="color:#aaa;text-decoration: line-through">' + item.label + ' (disabled)</li>').appendTo(ul);
    } else {
        return $("<li></li>")
                   .data("item.autocomplete", item)
                   .append("<a class='ui-corner-all'>" + item.label + "</a>")
                   .appendTo(ul);
    }
}