Show Posts
|
Pages: 1 ... 7 8 [9]
|
121
|
General Category / EasyUI for jQuery / Re: JqueryUI and Easyui Conflict
|
on: March 16, 2017, 09:44:46 AM
|
Thanks for the tip. In fact, my question is asking for the easyui version for my jqueryUI code. My jqueryui code works fine. But I need the solution using easyui alone. I want to completely remove the jqueryui code and use only the easyui. Hope you can help me.
Thanks
|
|
|
122
|
General Category / EasyUI for jQuery / JqueryUI and Easyui Conflict
|
on: March 15, 2017, 10:23:09 AM
|
I am using the following JqueryUI autcomplete code for my personal project, but it conflicts with easyui. $(document).on('focus','.autocomplete_txt', function(){ type = $(this).data('type'); if(type =='batch' ) autoTypeNo=0; if(type =='name' ) autoTypeNo=1; $(this).autocomplete( { source: function( request, response ) { $.ajax({ url : 'loaditems.php', dataType: "json", method: 'post', data: { name_startsWith: request.term, type: type }, success: function( data ) { response( $j.map( data, function( item ) { var code = item.split("|");//data from loaditem.php are separated with pipe return { label: code[autoTypeNo], value: code[autoTypeNo], data : item } })); } }); }, autoFocus: true, minLength: 0, select: function( event, ui ) { var names = ui.item.data.split("|"); id_arr = $(this).attr('id'); id = id_arr.split("_"); $('#itemNo_'+id[1]).val(names[0]); $('#itempName_'+id[1]).val(names[1]); $('#quantity_'+id[1]).val(); $('#price_'+id[1]).val(names[2]); $('#total_'+id[1]).val( 1*names[2] ); $('#itemtid_'+id[1]).val(names[3]); $('#catid_'+id[1]).val(names[4]); $('#itemUnit_'+id[1]).val(names[5]); $('#drid_'+id[1]).val(names[6]); calculateTotal(); }, open: function(event, ui) { $(".ui-autocomplete").css("z-index", 90009); } }); }); So I used this workaround: var $j = $.noConflict(true); and added j to every $ of the JqueryUI version. The best Easyui Version I come across the forum and the site is combobox . But after several attempts, I could not come to solution because my combox is in a loop. Here is the jquery loop where I am trying to put the combobox. $(document).ready(function() { var i=$('#dlg table tr').length; $(".addmore").on('click', function(){ console.log('test'); html = '<tr>'; html += '<td><input class="case" type="checkbox"/></td>'; html += '<td><input type="text" style="width:100%;" data-type="batch" name="itemNo[]" id="itemNo_'+i+'" class="form-control autocomplete_txt" autocomplete="off" placeholder="Scan Barcode"></td>'; html += '<td><input type="text" data-type="name" name="itempName[]" id="itempName_'+i+'" class="form-control autocomplete_txt" autocomplete="off" style="width:100%;" placeholder="Item Name"></td>'; html += '<td><input class="form-controller man" name="itemUnit[]" id="itemUnit_'+i+'" data-type="itemUnit" style="width:100%;" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>'; html += '<td><input type="hidden" data-type="drid" name="drid[]" id="drid_'+i+'" class="autocomplete_txt did" autocomplete="off"><input type="hidden" data-type="id" name="itemtid[]" id="itemtid_'+i+'" class="autocomplete_txt pid" autocomplete="off"><input type="number" value="1" style="width:100%;" min="1" name="quantity[]" id="quantity_'+i+'" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>'; html += '<td><input type="number" min="1" style="width:100%;" name="price[]" id="price_'+i+'" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"><input type="hidden" name="catid[]" id="catid_'+i+'" class="autocomplete_txt" autocomplete="off"></td>'; html += '<td><input type="number" min="1" style="width:100%" name="total[]" id="total_'+i+'" class="form-control totalLinePrice" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>'; html += '</tr>'; $('#dlg table').append(html); i++; }); }); When I used combobox, it did not come in the newly added row when user click add-more button. It works only with the first row. I would love to see if the same JqueryUI code can be achieved with Easyui alone. Thanks
|
|
|
124
|
General Category / EasyUI for jQuery / Re: Save data on Edatagrid on enter key press.
|
on: March 10, 2017, 09:20:52 AM
|
This code works fine. But I want reload the datagrid and add new row. Is that possible and How? onBeginEdit: function(index,row){ var dg = $(this); var editors = dg.edatagrid('getEditors',index); for(var i=0; i<editors.length; i++){ $(editors.target).textbox('textbox').bind('keydown',function(e){ if (e.keyCode == 13){ dg.edatagrid('endEdit', index); // if (index<dg.edatagrid('getRows').length-1){ // dg.edatagrid('selectRow', index+1).edatagrid('beginEdit', index+1); // } //$('#dg').edatagrid('reload'); $('#dg').edatagrid('addRow'); } }); } if (editors.length){ $(editors[0].target).textbox('textbox').focus(); } }
|
|
|
125
|
General Category / EasyUI for jQuery / Save data on Edatagrid on enter key press.
|
on: March 10, 2017, 08:42:17 AM
|
I have the following code for my edatagrid. And it works fine. But I need a feature: save data on hitting Enter Key. $('#dg').edatagrid({ url: 'get_customer.php', saveUrl: '../controller/save_customer.php', updateUrl: '../controller/update_customer.php', destroyUrl: '../controller/destroy_customer.php' });
|
|
|
126
|
General Category / EasyUI for jQuery / Re: How to bold the column header in the exported?
|
on: March 09, 2017, 08:47:51 AM
|
Thanks Jerry, But your code does not include the footer: I use below code to solve my problem. I also solved the bold column header now using the strong tag in the table code. One more feature I would like to add is adding the caption of the table with extra parameter in the method like: $('#dg').datagrid('toExcel','Customer.xls','List of Customer');. I am trying something to caption tag using insertBefore, but it always outputs `undefined` when opened in Excel 2013. And It does not merge the column also. Here is the working code without the caption. $.extend($.fn.datagrid.methods, { toExcel: function(jq, filename){ return jq.each(function(){ var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns=" http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' , base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) } , format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) } var alink = $('<a style="display:none"></a>').appendTo('body'); var view = $(this).datagrid('getPanel').find('div.datagrid-view'); var table = $(this).datagrid('getPanel').find('div.datagrid-view2').clone(); var tbody = table.find('>tbody'); view.find('div.datagrid-view1 table.datagrid-btable>tbody>tr').each(function(index){ $(this).clone().children().prependTo(tbody.children('tr:eq('+index+')')); }); var ctx = { worksheet: name || 'Worksheet', table: table.html()||'' }; alink[0].href = uri + base64(format(template, ctx)); alink[0].download = filename; alink[0].click(); alink.remove(); }) } });
|
|
|
127
|
General Category / EasyUI for jQuery / How to bold the column header in the exported?
|
on: March 08, 2017, 11:22:28 PM
|
I have got this code from this forum: When I use the code in my application. The exported excel does not bold the column header? $.extend($.fn.datagrid.methods, { toExcel: function(jq, filename){ return jq.each(function(){ var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' , base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) } , format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }
var alink = $('<a style="display:none"></a>').appendTo('body'); var view = $(this).datagrid('getPanel').find('div.datagrid-view'); var table = $(this).datagrid('getPanel').find('div.datagrid-view2').clone(); var tbody = table.find('>tbody'); view.find('div.datagrid-view1 table.datagrid-btable>tbody>tr').each(function(index){ $(this).clone().children().prependTo(tbody.children('tr:eq('+index+')')); }); var ctx = { worksheet: name || 'Worksheet', table: table.html()||'' }; alink[0].href = uri + base64(format(template, ctx)); alink[0].download = filename; alink[0].click(); alink.remove(); }) } }); Is there any way to append caption tag for the title of the table?
|
|
|
129
|
General Category / EasyUI for jQuery / How to create datagrid with new data on opening a window
|
on: November 28, 2016, 12:57:52 AM
|
I have tried the following code to open a window using javascript: <div id="expwin" class="easyui-window"> <table id="expdg"></table> </div> $('#expwin').window({'onOpen', function(){ var t = $('#expdg').datagrid({ url:'get_expiring.php', toolbar: '#exptoolbar', pagination:true, columns:[[ {field:'drugname',title:'name',width:100}, {field:'batchno',title:'batch',width:100}, {field:'pack',title:'package',width:100}, {field:'qps',title:'qpur',width:100}, {field:'qs',title:'qsold',width:100}, {field:'qout',title:'qout',width:100}, {field:'entrydate',title:'endate',width:100}, {field:'mdate',title:'mdate',width:100}, {field:'expdate',title:'edate',width:100,align:'right'} ]] }); return t; } }); To open the window: <div class="t-list" onclick="$('#expwin').window('open')">test</div> The problem is that there is no error in the console, and this does not populate the datagrid table as well. I want to populate the datagrid with data from get_expiring.php when I click test. How can I achieve this?
|
|
|
134
|
General Category / EasyUI for jQuery / How to set the value of textbox in Dialogue using JS?
|
on: October 27, 2016, 09:30:25 AM
|
var q = $('#qnty'); var t = $('#pSize'); t.textbox('textbox').bind('change keyup blur keydown', function(e){ q.textbox('setValue', $(this).val()); }); I am trying to set the value in pSize to qnty using the above but it does not yield any result nor error. My form is in the dialogue. Is it a bug or is there something missing in the code? Your help is greatly appreciated.
|
|
|
|