Show Posts
|
Pages: [1] 2 3 4
|
3
|
General Category / EasyUI for jQuery / Treegrid with filter
|
on: December 18, 2016, 09:03:07 PM
|
Dear all... I've made treefrid with filter facility like this: HTML: <table id="tgKALAKD" class="easyui-treegrid" data-options=" fit:true, url:'_modul/mod_kalakd/aksi_kalakd.php?act=listKALAKD', rownumbers: true, idField: 'kalid', treeField: 'nama', onBeforeLoad: function(row,param){ if (!row) { // load top level rows param.id = 0; // set id=0, indicate to load new page rows } } " >
PHP: $id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$where="pParent=".$id; $result = array(); if ($id == 0){ $qry = "SELECT * FROM uj_akad_kalender WHERE ".$where; $res = $conDB->query($qry); $result["total"] = $res->num_rows;
$qry = "SELECT t2.*, (SELECT COUNT(*) FROM uj_akad_kalender AS t1 WHERE t1.pParent = t2.kalid) AS count_parents FROM uj_akad_kalender AS t2 "; $qry.= "where ".$where; $res = $conDB->query($qry); $items = array(); while($row = $res->fetch_assoc()){ if($row['count_parents']>0) { $row['state']='closed'; } else { $row['state']='open'; } if (!is_null($row[tgl_awal])) { $nyatgl=strtotime($row[tgl_awal]); $row[tgl_awal]=date("d-m-Y",$nyatgl); } else { $row[tgl_awal]=""; } if (!is_null($row[tgl_akhir])) { $nyatgl=strtotime($row[tgl_akhir]); $row[tgl_akhir]=date("d-m-Y",$nyatgl); } else { $row[tgl_akhir]=""; } $row['caption']=trim($row['nama']." ".$row['ketambah']); array_push($items, $row); } $result["rows"] = $items; } else { $qry = "SELECT t2.*, (SELECT COUNT(*) FROM uj_akad_kalender AS t1 WHERE t1.pParent = t2.kalid) AS count_parents FROM uj_akad_kalender AS t2 "; $qry.= "where ".$where; $res = $conDB->query($qry); $items = array(); while($row = $res->fetch_assoc()){ if($row['count_parents']>0) { $row['state']='closed'; } else { $row['state']='open'; } if (!is_null($row[tgl_awal])) { $nyatgl=strtotime($row[tgl_awal]); $row[tgl_awal]=date("d-m-Y",$nyatgl); } else { $row[tgl_awal]=""; } if (!is_null($row[tgl_akhir])) { $nyatgl=strtotime($row[tgl_akhir]); $row[tgl_akhir]=date("d-m-Y",$nyatgl); } else { $row[tgl_akhir]=""; } $row['caption']=trim($row['nama']." ".$row['ketambah']); array_push($result, $row); } } echo json_encode($result);
How to bring up the child, including the parent when the filter without having to expand it first... because the parent will appear when it has been in expand. Here is a screenshot happened: 1. When first run (f-1.jpg) 2. Filter before expand (f-2.jpg) 3. Filter when it has expand (f-3.jpg) 4. I want a result like this (f-4.jpg) Please help me...
|
|
|
5
|
General Category / General Discussion / Re: Menubutton must click twice when open window
|
on: December 09, 2016, 08:26:33 PM
|
Thanks for your response jarry... I want to run my function with single click not double click... The problem is when I click that menu item, it does not carry out my functions. I must click it again to run it... How to fix it, so when I click my menu item can perform my functions without having to click again ....
|
|
|
6
|
General Category / General Discussion / Menubutton must click twice when open window
|
on: December 09, 2016, 07:36:07 PM
|
Dear All.. I've made datagrid with menubutton on it's toolbar to print pdf on new window. I always must click twice before open that new window with window.open This is my script... HTML: <table id="dgCTKKUL" style="width:930px;min-height:100%"></table> <div id="tbCTKKUL" style="height:27px;" class="hidenshow"> <div style="float:left;margin:1px;"> <input id="cariCTKKUL" class="easyui-searchbox" data-options="prompt:'Cari Kode/Nama Mata Kuliah',searcher:searchCTKKUL" style="width:300px;"></input> </div> <div style="float:right;margin:1px"> <a href="#" class="easyui-menubutton c1" iconCls="fa fa-print" plain="false" data-options="menu:'#mmCTKABSKUL'" style="height:25px;"><B>Cetak Absen</B></a> <div id="mmCTKABSKUL" style=""> <div data-options="iconCls:'icon-ok-2'" onClick="cetakABSKUL('pilih','')">Sesuai Pilihan</div> <div data-options="iconCls:'icon-list-m1-list'" onClick="cetakABSKUL('semua','')">Keseluruhan</div> </div> <a href="#" class="easyui-menubutton c2" iconCls="fa fa-print" plain="false" data-options="menu:'#mmCTKABKKUL'" style="height:25px;"><B>Cetak Absen Kosong</B></a> <div id="mmCTKABKKUL" style=""> <div data-options="iconCls:'icon-ok-2'" onClick="cetakABSKUL('pilih','ksg')">Sesuai Pilihan</div> <div data-options="iconCls:'icon-list-m1-list'" onClick="cetakABSKUL('semua','ksg')">Keseluruhan</div> </div> </div> </div>
JS: $('#dgCTKKUL').datagrid({ rownumbers:true,toolbar:'#tbCTKKUL',pagination:true,pageSize:25,pageList: [25,50,100,200,300], url:'_modul/mod_ctkkuliah/aksi_ctkkuliah.php?act=listJADKUL',remoteSort:true, sortName:'hari',striped:true, view:groupview, groupField:'kodenama', groupFormatter:function(value,rows){ return value + ' <i class="fa fa-long-arrow-right" style="color:#6E5888"></i> <i style="color:#367FA6">' + rows.length + ' kelas</i>'; }, columns:[[ {field:'ck',checkbox:true}, {field:'hari',width:70,align:'center',sortable:true,formatter:formatNamaHari,title:'Hari'}, {field:'jamkuliah',width:90,align:'center',sortable:false,title:'Jam'}, {field:'kodemk',width:100,align:'center',sortable:true,title:'Kode MK'}, {field:'namamk',width:200,align:'left',sortable:true,title:'Nama MK'}, {field:'nama_kelas',width:60,align:'center',sortable:false,formatter:namakelas, title:'Kelas'}, {field:'namadosen',width:200,align:'left',sortable:true,title:'Dosen Pengasuh'}, {field:'ruang',width:70,align:'center',sortable:false,title:'Ruang'}, {field:'jmlpeserta',width:70,align:'center',sortable:false,title:'Peserta'} ]], singleSelect:true, ctrlSelect:true, checkOnSelect:false, selectOnCheck:false, idField:'kodemkelas' });
function cetakABSKUL(pilihCTK,kosong){ timestamp = new Date().getTime(); if(pilihCTK=='pilih') { rowsCHECKED = $("#dgCTKKUL").datagrid("getChecked"); countCHECKED = rowsCHECKED.length; if(countCHECKED>0) { jsonObj = []; for (i = 0; i < countCHECKED; i++) { item = {}; item ["kmk"] = rowsCHECKED[i].kodemk; item ["kls"] = rowsCHECKED[i].kelas; jsonObj.push(item); } jsonStr = JSON.stringify(jsonObj); $.post('_modul/mod_ctkkuliah/aksi_ctkkuliah.php?act=cetakABSENKULIAH&ts='+timestamp,{datanya:jsonStr,id:1,absong:kosong},function(result){ if (result.success){ window.open('_assets/_topdf/new_topdf1.php?ts='+timestamp+'&/i1/='+result.encPDF1+'&/i2/='+result.encPDF2+'&/i3/='+result.savepdf,'_blank','width=800,height=500,resizable=yes,location=yes,status=yes,toolbar=yes,menubar=yes,scrollbars=yes,left=600,top=0'); $("#dgCTKKUL").datagrid("clearChecked"); } else { messager_alert(toTitleCase(result.show), result.message, result.show); } },'json'); } else { var row = $('#dgCTKKUL').datagrid('getSelected'); if (row){ if(row.jmlpeserta>0) { $.post('_modul/mod_ctkkuliah/aksi_ctkkuliah.php?act=cetakABSENKULIAH&ts='+timestamp,{kmk:row.kodemk,kls:row.kelas,id:2,absong:kosong},function(result){ if (result.success){ window.open('_assets/_topdf/new_topdf1.php?ts='+timestamp+'&/i1/='+result.encPDF1+'&/i2/='+result.encPDF2+'&/i3/='+result.savepdf,'_blank','width=800,height=500,resizable=yes,location=yes,status=yes,toolbar=yes,menubar=yes,scrollbars=yes,left=600,top=0') } else { messager_alert(toTitleCase(result.show), result.message, result.show); } },'json'); } else { messager_alert('Error','Tidak ada yang bisa dicetak!','error'); } } else { messager_alert('Error','Anda belum memilih data!','error'); } } } else { $.post('_modul/mod_ctkkuliah/aksi_ctkkuliah.php?act=cetakABSENKULIAH&ts='+timestamp,{id:3,absong:kosong},function(result){ if (result.success){ window.open('_assets/_topdf/new_topdf1.php?ts='+timestamp+'&/i1/='+result.encPDF1+'&/i2/='+result.encPDF2+'&/i3/='+result.savepdf,'_blank','width=800,height=500,resizable=yes,location=yes,status=yes,toolbar=yes,menubar=yes,scrollbars=yes,left=600,top=0') } else { messager_alert(toTitleCase(result.show), result.message, result.show); } },'json'); } }
function namakelas(val,row){ if (row.nonkrs>0){ return '<span>X</span>'; } else { return '<span>'+val+'</span>'; } }
The problem only when I click menubutton to run my function (cetakABSKUL), I must click twice... I don't know how to fix it... Can anyone help me? Sorry if my english is not well....
|
|
|
8
|
General Category / EasyUI for jQuery / Combogrid Pagination with 6000 data's
|
on: November 21, 2016, 01:46:12 AM
|
Dear All... I've create combogrid with pagination that contains about 6000 data's... It works well (see combogrid-oke.jpg)... Problems arise on edit mode when its value was on page 2 (on page 1 it works fine - combogrid-oke-oke.jpg) and so only appear idField (without textField - see combogrid-not-oke.jpg). How to fix it? Can anyone help me? This is my code HTML <input id="asptimsmhs_datamhs" name="asptimsmhs" class="easyui-combogrid" style="width:95%;height:20px;" prompt="Pilih" data-options=" panelWidth:400,panelHeight:'auto', url: '_modul/mod_datamhs/aksi_datamhs.php?act=asal_pt', idField:'kdptitbpti', textField:'nmptitbpti', mode:'remote', pagination:true, pageSize:10, pageList: [10], multiple:false,fitColumns:true, columns:[[ {field:'kdptitbpti',title:'Kode',align:'center',width:50}, {field:'nmptitbpti',title:'Nama Perguruan Tinggi',width:250} ]], " >
PHP: $q = isset($_POST['q']) ? strval($_POST['q']) : ''; $page = isset($_POST['page']) ? intval($_POST['page']) : 1; $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 15; $offset = ($page-1)*$rows; $result = array(); $sql = "SELECT kdptitbpti,nmptitbpti FROM _tbpti WHERE kdptitbpti LIKE '%$q%' OR nmptitbpti LIKE '%$q%'"; $res = $conDB->query($sql); $result["total"] = $res->num_rows; $sql="SELECT kdptitbpti,nmptitbpti FROM _tbpti WHERE kdptitbpti LIKE '%$q%' OR nmptitbpti like '%$q%' limit $offset,$rows"; $res = $conDB->query($sql); $rows = array(); while($row = $res->fetch_assoc()){ array_push($rows, $row); } $result["rows"] = $rows; echo json_encode($result);
Please help.... Thx
|
|
|
10
|
General Category / EasyUI for jQuery / Using key up, key down and enter key on edatagrid
|
on: October 28, 2016, 08:55:00 PM
|
Dear All... I've create edatagrid like this and it work perfect... $('#dgNILMKDOSnilai').edatagrid({ updateUrl: '_modul/mod_nilmkdos/aksi_nilmkdos.php?act=updateNILMKDOS&pabs='+proABS+'&ptgs='+proTGS+'&puts='+proUTS+'&puas='+proUAS }); $('#dgNILMKDOSnilai').edatagrid({ fit:true,rownumbers:true,rownumberWidth:40,singleSelect:true,striped:true,emptyMsg:'Tidak Ada Data', url:'_modul/mod_nilmkdos/aksi_nilmkdos.php?act=listNILMKDOS',idField:'khsid',remoteSort:false, queryParams:{param:opts.param,cetak:sudahcetak}, columns:[[ {field:'nim',title:'NIM/No. Pokok',width:130, align:'center',rowspan:2}, {field:'nama',title:'Nama Peserta',width:300,rowspan:2}, {title:'Hadir'},{title:'Tugas'},{title:'UTS'},{title:'UAS'},{title:'Nilai',align:'center',colspan:2} ],[ {id:'idhadir',field:'hadir',width:70,title:proABS+'%',align:'center',styler:cellStylerBack}, {id:'idtugas',field:'tugas',width:70,title:proTGS+'%',align:'center',styler:cellStylerBack}, {id:'iduts',field:'uts',width:70,title:proUTS+'%',align:'center',styler:cellStylerBack}, {id:'iduas',field:'uas',width:70,title:proUAS+'%',align:'center',styler:cellStylerBack}, {field:'nil_angka',title:'Angka',width:70,align:'center',styler:cellStylerBold}, {field:'nil_huruf',title:'Huruf',width:70,align:'center',styler:cellStylerBold} ]], onBeforeEdit: function(index,row){ var colHDR = $(this).edatagrid('getColumnOption', 'hadir'); var colTGS = $(this).edatagrid('getColumnOption', 'tugas'); var colUTS = $(this).edatagrid('getColumnOption', 'uts'); var colUAS = $(this).edatagrid('getColumnOption', 'uas'); // if(parseInt(sudahcetak)==0) { colHDR.editor = { type:'numberbox',options:{required:true,min:0,missingMessage:'Wajib di-isi',validType:'isiHADIR[75,100]'} }; colTGS.editor = colUTS.editor = colUAS.editor = { type:'numberbox',options:{required:true,min:0,missingMessage:'Wajib di-isi',validType:'isi[0,100]'} }; } else { colHDR.editor = colTGS.editor = colUTS.editor = colUAS.editor = null; } // }, onRowContextMenu: function(e, rowIndex, rowData){ e.preventDefault(); $(this).datagrid('unselectAll'); $(this).datagrid('selectRow', rowIndex); if (!$('#tmenuNILMKdos').length){ var tmenuNILMKdos = $('<div id="tmenuNILMKdos" style="width:120px;"></div>').appendTo('body'); $('<div id="tmenuNILMKdos_cancel" iconCls="icon-undo-2" />').html('Cancel').appendTo(tmenuNILMKdos); tmenuNILMKdos.menu({ onClick: function(item){ if(item.id=="tmenuNILMKdos_cancel") { $('#dgNILMKDOSnilai').edatagrid('cancelRow'); } else { } } }); } $('#tmenuNILMKdos').menu('show', { left: e.pageX, top: e.pageY }); } });
Can we add keyboard function like key up/down and enter key on edatagrid to automatically save current row and beginEdit next row? Please help Thx
|
|
|
14
|
General Category / EasyUI for jQuery / Re: Datagrid with checkbox
|
on: October 14, 2016, 06:34:09 PM
|
Thanks sworty... I've tried... This is my code... $('#dgIEIRSmhs').datagrid({ url:'_modul/mod_irs/aksi_irs.php?act=listJADKULKRS',method:'post',striped:true,loadMsg:'Loading',showHeader:true,rownumbers:true,rownumberWidth:40,remoteSort:false,multiSort:true, singleSelect:true, ctrlSelect:true, checkOnSelect:false, selectOnCheck:false, columns:[[ {field:'hari',title:'Hari',width:60,align:'center',formatter:formatNamaHari,sortable:true}, {field:'jamkul',title:'J a m',width:85,align:'center',sortable:true}, {field:'kodemk',title:'Kode MK',width:85,align:'center',sortable:true}, {field:'namamk',title:'Nama Mata Kuliah',width:190,align:'left',sortable:true}, {field:'semester',title:'SMT',width:40,align:'center'}, {field:'sks',title:'SKS',width:40,align:'center'}, {field:'nama_kelas',title:'Kelas',width:40,align:'center'}, {field:'namados',title:'Dosen',width:190,align:'left',sortable:true}, {field:'ruang',title:'Ruang',width:70,align:'center',sortable:true}, {field:'ambil',checkbox:true,width:50} ]], rowStyler: function(index,row){ if(row.ambil) { return 'background-color:#6293BB;color:#fff;'; } }, onLoadSuccess: function(data){ for(var i=0; i<data.rows.length; i++){ if(data.rows[i]['ambil']) { $(this).datagrid('checkRow', i); } } }, onCheck: function(index,row){ row.ambil=1; //alert(row.ambil); }, onUncheck: function(index,row){ row.ambil=0; //alert(row.ambil); } });
When I check th checkbox, my row background color didn't change... How to fix it? Thx
|
|
|
15
|
General Category / EasyUI for jQuery / Datagrid with checkbox
|
on: October 13, 2016, 08:28:17 PM
|
Hai... I want to make datagrid with checkbox facilities. Here are some of my questions. - Can I add onchange action on the checkbox to make some checkbox disabled which have some condition
This is my JS $('#dgIEIRSmhs').datagrid({ url:'_modul/mod_irs/aksi_irs.php?act=listJADKULKRS',method:'post',striped:true,loadMsg:'Loading',showHeader:true,rownumbers:true,rownumberWidth:40,remoteSort:false,multiSort:true, singleSelect:true, ctrlSelect:true, checkOnSelect:false, selectOnCheck:false, columns:[[ {field:'hari',title:'Hari',width:60,align:'center',formatter:formatNamaHari,sortable:true}, {field:'jamkul',title:'J a m',width:85,align:'center',sortable:true}, {field:'kodemk',title:'Kode MK',width:85,align:'center',sortable:true}, {field:'namamk',title:'Nama Mata Kuliah',width:190,align:'left',sortable:true}, {field:'semester',title:'SMT',width:40,align:'center'}, {field:'sks',title:'SKS',width:40,align:'center'}, {field:'nama_kelas',title:'Kelas',width:40,align:'center'}, {field:'namados',title:'Dosen',width:190,align:'left',sortable:true}, {field:'ruang',title:'Ruang',width:70,align:'center',sortable:true}, {field:'ambil',title:'Ambil',width:60,align:'center', formatter: function (value) { if (value == 1) { return '<input type="checkbox" checked>'; } else { return '<input type="checkbox" >'; } } } ]], rowStyler: function(index,row){ if(row.ambil==1) { return 'background-color:#6293BB;color:#fff;'; } } });
Please help me...
|
|
|
|