프로그램/jQuery

jQuery memo dialog example

mulderu 2010. 6. 24. 14:43
오늘 만든건데.. 계속 버전업할 생각 입니다.....
한번 사용해 보세요 ㅋㅋㅋ





      //-----------------------------------------------

// my JQuery UI Dialog Maker by Mulder
//-----------------------------------------------
// opt.dlgid
// opt.title
// opt.txtid
// opt.cols
// opt.rows
// opt.width
// opt.height
// opt.savefunc
// opt.prologue
// opt.deftext : default text
var gxPrebuildedDlg = new Array();
makeMemoDialogEx = function(opt) {
if(!isValidObj (gxPrebuildedDlg[opt.dlgid])) {
var s = '';
s += '<div id="'+opt.dlgid+'" style="display:none">';
s += opt.prologue;
s += '<form>';
s += '<fieldset>';
s += '<textarea id="'+opt.txtid+'" cols="'+opt.cols+'" rows="'+opt.rows+'" class="text ui-widget-content ui-corner-all"></textarea>';
s += '</fieldset>';
s += '</form></div>';
$('#dlg_area').append(s);
gxPrebuildedDlg[opt.dlgid] = $('#'+opt.dlgid);
}
$('#'+opt.dlgid+ ' textarea[id='+opt.txtid+']').val(opt.deftext);
$('#'+opt.dlgid).dialog({
title: opt.title,
modal: true,
width: opt.width,
height: opt.height,
buttons: {
Save   : function() { opt.savefunc($('#'+opt.dlgid+ ' textarea[id='+opt.txtid+']').val()); },
Cancel : function() { $(this).dialog('close'); }
},
position: "center",
closeOnEscape: true
});
}
 

// 상품상세정보 보기 클릭, editor open
$('#btn_action_descedit').click(function(){
var gr = jQuery("#gd_main_area").jqGrid('getGridParam','selrow');
if( gr != null ) {
var rowData = $("#gd_main_area").getRowData(gr);
makeMemoDialogEx ( {
dlgid : 'dlg_desca_update',
title : '상품 상세정보 편집',
txtid : 'desca_data',
cols  : 85, rows : 15,
width : 700, height: 400,
savefunc : function(memoText) {
actionHelper (actionNameEx, { 
cd:"update", act:"desc_update,desca", 
                       title: urlEncode ( memoText ),
           s_key1: gx_selectedCateCode, s_key2: gr }, 
function() {    
alert ('Update DESCA');
$('#gd_main_area').trigger("reloadGrid");
});
},
prologue : '',
deftext : rowData["frm.dto.desca"]
});
}
else {
alert("Please Select Row");
}
return false;
});