Beberapa pengalaman dalam menggunakan Jquery Easyui.
a. Event doubel click pada datagrid :
function doReferensi3() {
var operasi = 'referensi';
//var sub = $('#kelompok').combobox('getValues');
$('#dlg'+operasi).dialog({
title: 'Referensi Tabel Barang Persediaan',
closed: false,
cache: false,
modal: true,
top : 20
});
$('#rendering_table2').datagrid({
width:1150,
height:350,
border:0,
pagination :true,
singleSelect:true,
rownumbers : true,
fit:true,
url:'select.php?tipe=kode_persediaan&g=7',
frozenColumns:[[
{field:'kodebarang',title:'Kode Barang',width:150,align:'left',sortable:true},
{field:'namabarang',title:'Nama Barang',width:500,align:'left',sortable:true},
]] ,
onDblClickRow : function(index,row){
$('#KODE_BARANG_PERSEDIAAN').val(row.kodebarang);
$('#NAMA_BARANG_PERSEDIAAN').val(row.namabarang);
$('#dlg'+operasi).dialog('close');
},
pagination:true,
rownumbers:true
});
$('#rendering_table2').datagrid('reload');
$('#dlg'+operasi).dialog({
width : '60%',
height : 350,
});
$('#dlg'+operasi).dialog('center');
}
b. Event OnSelect pada ComboBox :
function getJenisKunjungan(id){
$(id).combobox({
multiple : false,
valueField:'id', //sesuaikan yg di get select
textField:'text',
readonly : false,
panelHeight : true,
url:'select.php?tipe=jenisKunjungan',
onSelect : function(rec) {
if (rec.id=='') {
$(this).combobox('setValues', ['']);
}else{
getDiagnosis('#diagnosis');
}
}
});
}
c. Event OnSelect pada combogrid:
function getMasterBarang(id) {
var bulan = $('#bulan').combobox('getValue');
var tahun = $('#tahun').combobox('getValue');
//var row = $('#rendering_table').datagrid('getSelected');
$(id).combogrid({
panelWidth:'55%',
idField:'idmasterBarang',
textField:'namaBarang',
url:'get_sisa_barang.php?bulan='+bulan+'&tahun='+tahun,
delay: 500,
mode: 'remote',
columns:[[
{field:'namaBarang',title:'Nama Barang',width:200,align:'left',sortable:true},
{field:'satuanBarang',title:'Satuan Barang',width:50,align:'left',sortable:true},
{field:'showhargaBarang',title:'Harga Barang',width:100,align:'right',sortable:true},
{field:'sisaBarang',title:'Sisa Barang',width:100,align:'center',sortable:true},
]],
onSelect : function(rec,row) {
//var g = $('#idMasterBarang').combogrid('grid'); // get datagrid object
//var r = g.datagrid('getSelected'); // get the selected row
//console.log(row);
if (rec.id=='') {
$(this).combobox('setValues', ['']);
} else {
$('#hargaBarang').val(row.showhargaBarang);
$('#sisaBarang').val(row.sisaBarang);
}
},
pagination:true,
rownumbers:true
});
}