Show Posts
|
Pages: 1 [2] 3 4 ... 11
|
17
|
General Category / EasyUI for jQuery / problem using datetimebox in form
|
on: April 27, 2015, 09:57:46 PM
|
hello again. i have a problem using datetimebox plugin in form, and i have a custom formatter and parser for that datetimebox. here is my code : $.fn.datetimebox.defaults.formatter = function(date){ var arrMonth = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; console.log(date); ==> always undefined when load data in form var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear();
var hh = date.getHours(); var mm = date.getMinutes();
return (d < 10 ? ('0' + d) : d) + ' ' + arrMonth[m] + ' ' + y + ' ' + hh + ':' + mm; }
$.fn.datetimebox.defaults.parser = function (s){ var arrMonth = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
if (!s) return new Date();
if (s.indexOf('-') > 0) { var ss = (s.split('-')); var y = parseInt(ss[0], 10); var m = parseInt(ss[1], 10) - 1; var d = parseInt(ss[2], 10);
} else { var ss = (s.split(' ')); var y = parseInt(ss[2], 10); var m = arrMonth.indexOf(ss[1]); var d = parseInt(ss[0], 10);
} if (!isNaN(y) && !isNaN(m) && !isNaN(d)) { var date = new Date(y, m, d);
if (ss[3] != null){ var t = ss[3].split(":"); date.setHours(t[0]); date.setMinutes(t[1]); } return date;
}else{ return new Date(); } }
everytime i trying to load form data, date parameter always shows undefinde value, and format value for load into datetimebox is like this "2015-04-28 16:00:00" am i missing something? many thanks for the answer
|
|
|
18
|
General Category / EasyUI for jQuery / updateRow method end the editing event
|
on: April 08, 2015, 08:59:51 PM
|
hello again. i have a problem with updateRow method. i have a datagrid using editing method in row, and i some field using combogrid and have an event when i select one of the options, it will update the current row. but when i call updateRow method, the datagrid will ending editing mode. here is my code: onBeginEdit: function(index,row){ var ccy_ori = $(this).datagrid('getEditor',{index: index,field: 'ccy_ori'}); var row_grid = row; var idx = index; setValueGridEditorNew(ccy_ori, 'grid');
$(ccy_ori.target).combogrid('attachEvent',{ event: 'onSelect', handler: function(index,row){ row_grid.ccy_ori_name = row.currency_name; row_grid.ccy_ori = row.currency_id; var invoice_date = $('#invoice_date').datebox('getValue');
$.get("#{sc_get_currency_rate_m_invoice_as_path(:prm => params[:prm])}", { prm_currency_id: row_grid.currency_id, prm_currency_id_grid: row.currency_id, prm_invoice_date: invoice_date }, function(data){ if (data != null){
row_grid.ccy_rate = data.currency_rate; row_grid.ccy_rate_div = data.currency_rate_div;
sf_calculate_ccy_amount(row_grid, idx); }else{ $.messager.alert('Info','No Currency Rate found for currency '+row_grid.currency_name+' to '+row.currency_name); return false; } },'json'); } });
/* $(ccy_ori.target).combogrid({ onSelect: function(index, row){ row_grid.ccy_ori_name = row.currency_name; row_grid.ccy_ori = row.currency_id; var invoice_date = $('#invoice_date').datebox('getValue');
$.get("#{sc_get_currency_rate_m_invoice_as_path(:prm => params[:prm])}", { prm_currency_id: row_grid.currency_id, prm_currency_id_grid: row.currency_id, prm_invoice_date: invoice_date }, function(data){ if (data != null){
row_grid.ccy_rate = data.currency_rate; row_grid.ccy_rate_div = data.currency_rate_div;
sf_calculate_ccy_amount(row_grid, idx); }else{ $.messager.alert('Info','No Currency Rate found for currency '+row_grid.currency_name+' to '+row.currency_name); return false; } },'json'); } });
*/ }, -------------------------------------------------------- function sf_calculate_ccy_amount(row_data, idx){ if (row_data.ccy_rate > 0){ row_data.ccy_amount = parseFloat(row_data.oc_amount_other) * parseFloat(row_data.ccy_rate); $service_data.datagrid('updateRow',{ index: idx, row: { ccy_amount: parseFloat(row_data.oc_amount_other) * parseFloat(row_data.ccy_rate), ccy_rate: row_data.currency_rate, ccy_rate_div: row_data.currency_rate_div } });
}else if (row_data.ccy_rate_div > 0){ row_data.ccy_amount = parseFloat(row_data.oc_amount_other) / parseFloat(row_data.ccy_rate_div); $service_data.datagrid('updateRow',{ index: idx, row: { ccy_amount: parseFloat(row_data.oc_amount_other) / parseFloat(row_data.ccy_rate_div), ccy_rate: row_data.currency_rate, ccy_rate_div: row_data.currency_rate_div } }); }else{ row_data.ccy_amount = parseFloat(row_data.oc_amount_other); }
loadLinkbutton('#service_data');
}
it is possible to update an row while that row is on editing mode? many thanks for the answer
|
|
|
20
|
General Category / EasyUI for jQuery / extend load method in combogrid
|
on: March 25, 2015, 10:29:18 PM
|
hello again, i have a little problem about extending new mthod on combogrid plugins. i want to extend load datagrid method into combogrid. here is what i doing so far: $.extend($.fn.combogrid.methods, { LoadQueryParams: function(jq, param){ return jq.each(function(){ var grid = $(this).combogrid('grid'); var opts = $(this).combogrid('options'); console.log(opts); var queryParams = opts.queryParams; var params = $.extend(queryParams, param); console.log(queryParams); // var params = $.extend(opts.queryParams, param); console.log(params); // delete opts.queryParams; grid.datagrid('load',params); opts.queryParams = params; console.log(opts); }); } });
i want to change queryParams too when i used this method. but the result not like i expected. when i try console , queryParams object value is not same when i set using this method.? when i try to using this method in some combogrid, for example $('#cb1').combogrid('LoadQueryParams',{test:'1'}); but when i try debug in second combogrid, $('#cb2'), parameter test: '1' is exist too. how to apply a new properties without override existing element ? so it's just like ordinary method. many thanks for the answer.
|
|
|
22
|
General Category / EasyUI for jQuery / need help with keyHandler properties in combogrid.
|
on: March 24, 2015, 03:12:19 AM
|
hello again, i have a problem using keyHandler properties in combogrid. here is my code: <div class='fourth'> <div class='div-form'> <label>Route Assignments</label> <div> <input class="easyui-combogrid mc" data-options="prompt: 'Route Assignments', url: '/nst_lookup/nst_lcg_ra', mode: 'remote', method: 'get', queryParams:{type:'ra'}, panelWidth: 700, idField: 'ra_id', textField: 'ra_id', tipPosition: 'top', fitColumns:true, keyHandler: {enter: function(e){test();}}, onShowPanel:function(){return rowHeight(this);}, columns: [[{field: 'ra_id', width: 100,sortable:true},{field: 'hawb_list', width: 255,sortable:true},{field: 'mvo_ship_id_list', width: 255,sortable:true},{field: 'shipping_invoice_list', width: 255,sortable:true}]]" id="ra_id" name="m_ra_dr_a[ra_id]" style="width: 100%; height: 30px" type="text" /> </div> </div> </div>
and this error occured: Uncaught TypeError: Cannot read property 'call' of undefined
is my code wrong? many thanks for the answer.
|
|
|
24
|
General Category / EasyUI for jQuery / setting rowheight on combogrid
|
on: March 17, 2015, 02:28:36 AM
|
hello again, i have a simple question
i have a datagrid and setting rowHeight into 40px by overriding class .datagrid-row = 40px; but the problem is when i using combogrid, rowHeight on combogrid is 40px too (set to global rowheight). i want to make rowheight on combogrid into default height = 25px;
how to do that?
many thanks for the answer.
|
|
|
29
|
General Category / Bug Report / bugs using filter datagrid and rowspan columns properties.
|
on: March 13, 2015, 08:16:31 PM
|
hello again. i'm using filter extension on datagrid and adding rowspan properties on column, but the result is not what i expected. see bugs filter datagrig.png here is my code: <div class='easyui-panel' data-options='border: false, fit: true' style='padding: 5px;'> <div data-options='fit: true' id='list_data'></div> <div class='tb' id='tb_list_data'> <span> <!-- update01 ganti semua fungsi ac_get_nav_st dengan nst_get_nav_st --> <a class="easyui-linkbutton" data-options="plain:true" href="javascript:void(0)" iconCls="icon-back" onclick="close_wizard($list_data);">Close Wizard</a> </span> </div> </div> <script> // start VAR global atau yang dipakai berulang-ulang untuk function dibawah var frm_url ; // variable untuk url save, update, dan delete form var cmenu ; var rep_obj = 't_guest_a_master' ; //CUSTOMIZE var $list_data = $('#list_data') ; // define id yang di gunakan sebagai datagrid. var $frm_dlg = $('#frm_dlg') ; // define id yang di gunakan sebagai form modal. var $frm = $('#frm') ; // define id yang digunakan sebagai form di dalam form modal. var url_crud_row = ""; var init_url = "/t_guest_a_masters/sc_counter?prm=3783" // define url untuk digunakan sebagai counter. // stop VAR // start function untuk TABLE $(function(){ $('#list_data').datagrid({ title: "Invitation Event Wizard", url: "/t_guest_c_cats/sc_load_data_pivot_index?prm=3783", //CUSTOMIZE toolbar: "#tb_list_data", idField: 'id' , resizeHandle: "both" , autoRowHeight: true , striped: true , method: 'get' , fitColumns: false , remoteSort: true , remoteFilter: true , sortName: 'guest_id', //CUSTOMIZE sortOrder: 'desc', singleSelect: true, rownumbers: true, //pageSize: 20, // update01 , pageSize di comment. view: scrollview, multiSort: true, filterPosition: 'top', frozenColumns: [[ {field: 'action', title: 'Nav', width: 90, halign: 'center', align: 'center', formatter: function(value, row, index){ if (row.editing){ var s = '<a href="#" onclick="save_row(this, $list_data)" data-no-turbolink="true" id="save" class="easyui-linkbutton" iconCls="icon-save" title="Save"></a>'; var c = '<a href="#" onclick="cancel_row(this, $list_data)" data-no-turbolink="true" id="cancel" class="easyui-linkbutton" iconCls="icon-cancel" title="Cancel"></a>'; return s+" | "+c; }else{ var x = '<a href="#" onclick="show_form(this, $list_data, $frm_dlg, $frm, rep_obj)" data-no-turbolink="true" id="show" class="easyui-linkbutton" iconCls="icon-search" title="Show"></a>'; var e = '<a href="#" onclick="edit_row(this, $list_data)" data-no-turbolink="true" id="edit" class="easyui-linkbutton" iconCls="icon-edit" title="Edit"></a>'; var d = '<a href="#" onclick="delete_row(this, $list_data, url_crud_row, state)" data-no-turbolink="true" id="delete" class="easyui-linkbutton" iconCls="icon-remove" title="Delete"></a>'; return e; } } }, {field: 'guest_id' , title: 'Guest ID' , align: 'left' , halign: 'center', width:100,sortable: true, hidden: true}, {field: 'barcode_num' , title: 'Barcode' , align: 'center', halign: 'top', width:70 ,sortable: true}, {field: 'guest_name' , title: 'Invitation Name' , align: 'left' , halign: 'center', width:400,sortable: true}, {field: 'guest_cat' , title: 'Invitation Group', align: 'left' , halign: 'center', width:150,sortable: true}, {field: 'evt_level_id', title: 'Invitation Level', align: 'left' , halign: 'center', width:150,sortable: true, formatter: function(value,row,index){ return row.evt_level_name; } } ]], columns: [[{title: 'Event Category',halign: 'center', colspan: 4}],[{field: '0_event', title:'AKAD', align:'center', halign:'center',width:80, sortable: false, editor:{ type:'checkbox', options:{on: true,off: false} } },{field: '1_event', title:'SIRAMAN', align:'center', halign:'center',width:80, sortable: false, editor:{ type:'checkbox', options:{on: true,off: false} } },{field: '2_event', title:'RESEPSI', align:'center', halign:'center',width:80, sortable: false, editor:{ type:'checkbox', options:{on: true,off: false} } },{field: '3_event', title:'AFTER PARTY', align:'center', halign:'center',width:80, sortable: false, editor:{ type:'checkbox', options:{on: true,off: false} } }]], onHeaderContextMenu: function(e, field){ e.preventDefault(); if (!cmenu){ createColumnMenu($list_data); } cmenu.menu('show',{ left: e.pageX, top: e.pageY }); }, onBeforeEdit: function(rowIndex, rowData){ rowData.editing = true; updateActions(rowIndex, $list_data); loadLinkbutton(this); state.op = "edit"; }, // update01 , event onBeginEdit adalah custom, digunakan jika ada kondisi atau function tertentu yang ingin dijalankan saat crud di grid. onBeginEdit:function(index,row){ }, onAfterEdit: function(rowIndex, rowData, changes){ rowData.editing = false; sf_save_event_guest(this, rowData,rowIndex, changes); //getChange($list_data, url_crud_row, this, state, rowIndex, rowData); // update01 }, onCancelEdit: function(rowIndex, rowData){ rowData.editing = false; updateActions(rowIndex, $list_data); loadLinkbutton(this); state.op = "show"; }, onLoadSuccess: function(data){ loadLinkbutton(this); state.op = "show"; emptyRow(this, data.total); } }).datagrid('getPanel').attr('tabindex','-1').bind('keydown',function(e){ keyHandlerDatagrid(e.keyCode, $list_data, url_crud_row, $frm_dlg, $frm, rep_obj, state); }); // start function FILTER datagrid #CUSTOMIZE $list_data.datagrid('enableFilter', [ { field: 'action', type: 'label' } ] ); // stop function FILTER datagrid #CUSTOMIZE }); function sf_save_event_guest(target,row, index, changes){ var vurl = "/t_guest_c_cats/sc_save_guest_event?prm=3783"; if (changes){ var vchange = $(target).datagrid('getChanges', 'updated'); var list_data = JSON.stringify(vchange); // AJAX POST. $.post(vurl,{prm_list_data: list_data},function(data){ if (data.msg == "OK"){ $list_data.datagrid('acceptChanges'); updateActions(index,$list_data); loadLinkbutton(target); state.op = 'show'; state.row = ''; }else{ $.messager.alert('INFO',data.msg, 'info'); updateActions(index,$list_data); loadLinkbutton(target); state.op = 'show'; state.row = ''; $list_data.datagrid('rejectChanges'); return false; } },'json') .fail(function(data){ $.messager.alert('ERROR',"Something error Occured.",'error'); return false; }); }else{ updateActions(index,$list_data); loadLinkbutton(target); } } function close_wizard(dg){ $.messager.confirm("Confirmation","Close Wizard ?",function(r){ if (r){ window.location = "/t_guest_c_cats?prm=3783"; return false; } }); } function updateDataRow(index, target){ $list_data.datagrid('selectRow', index); var row = $list_data.datagrid('getSelected'); if (row){ $.ajax({ url: "/t_guest_a_masters/sc_refresh_row?prm=3783", dataType: 'json', type: 'get', data: { // update01 , sekarang hanya kirim id yang sudah di tampung di object state. id: state.id //CUSTOMIZE } }) .done(function(data){ $list_data.datagrid('updateRow', { index: index, row: { id: data.id, updated_by: data.updated_by, updated_at: formatDate(data.updated_at), evt_level_name: data.evt_level_name } }); loadLinkbutton(target); var data = $list_data.datagrid('getData'); emptyRow('#list_data', data.total); // update01 stop }) .fail(function(request, error, status){ $.messager.alert('Error', request.responseText); return false; }); } } // stop function untuk TABLE </script> </body>
many thanks for the answer.
|
|
|
30
|
General Category / EasyUI for jQuery / selectRecord not working on scrollview extension
|
on: March 13, 2015, 07:39:03 PM
|
morning all.
i have a datagrid using scrollview extension and i want to use 'selectRecord' method.
my datagrid have 1000 record. just said idField is like that. pageSize =10
now i'm in first page, but i want to select record with id =800. when i try to using that method, it doesn't works.
can anyone help me to make scrollview extension achieve this method?
many thanks for the answer.
|
|
|
|