function pStakreditasislta(){ var fields_stakreditasislta = RH.storeFields('idstakreditasislta','kdstakreditasislta','nmstakreditasislta','deskripsi'); var pageSize = 18; var ds_stakreditasislta = RH.JsonStore({ url : BASE_URL + 'stakreditasislta_controller/get_stakreditasislta', fields : fields_stakreditasislta, limit: pageSize, enableSearch: true, }); //SEARCH COMPONENT var sb_stakreditasislta = RH.searchComp({ id : 'sb_stakreditasislta', fields : ['kdstakreditasislta:Kode','nmstakreditasislta:Nama'], selected : 'nmstakreditasislta', store : ds_stakreditasislta }); // COLUMN MODEL var cm_stakreditasislta = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header: RH.h3('Kode'),width: 100, dataIndex: 'kdstakreditasislta', sortable: true }, { header: RH.h3('Nama'), width: 300, dataIndex: 'nmstakreditasislta', sortable: true }, { header: RH.h3('Deskripsi'), width: 300, dataIndex: 'deskripsi', sortable: true }, RH.EditColumn(), RH.DeleteColumn() ] ); /** THE GRID */ var gp_stakreditasislta = RH.GridPanel_T1({ ds: ds_stakreditasislta, cm: cm_stakreditasislta, singleSelect: true, searchComp: sb_stakreditasislta, allowAdd: true, fnAdd: fnAddStakreditasislta, pageSize: pageSize, cellclick: onCellStakreditasisltaClick }); var fp_stakreditasislta = RH.GPContainer1({ title: 'Status Akreditasi SLTA', iconCls:'silk-house', gridPanel: gp_stakreditasislta, }); SET_PAGE_CONTENT(fp_stakreditasislta); /** FUNCTIONS */ function onCellStakreditasisltaClick(grid, rowIndex, columnIndex, e) { var record = grid.getStore().getAt(rowIndex); // Get the Record RH.EditClick(e, function(){fnEditStakreditasislta(grid, record)}); RH.DeleteClick(e, function(){fnDeleteStakreditasislta(grid, record)}); } function reloadStakreditasislta(){ ds_stakreditasislta.reload(); } function fnAddStakreditasislta(){ var grid = gp_stakreditasislta; wEntryStakreditasislta(false, grid, null); } function fnEditStakreditasislta(grid, record){ wEntryStakreditasislta(true, grid, record); } function fnDeleteStakreditasislta(grid, record){ var url = BASE_URL + 'stakreditasislta_controller/delete_stakreditasislta'; var params = new Object({ idstakreditasislta : record.data['idstakreditasislta'] }); RH.deleteGridRecord(url, params, grid ); } } /** WIN - FORM ENTRY/EDIT STATUS AKREDITASI SLTA */ function wEntryStakreditasislta(isUpdate, grid, record){ var winTitle = (isUpdate)?'Status Akreditasi SLTA (Edit)':'Status Akreditasi SLTA (Entry)'; /** DATA SOURCE GRUP STATUS AKREDITASI SLTA */ /*var ds_grup = new Ext.data.JsonStore({ //static data fields: [{ name:'kode' }, { name:'nama' }], data: [ { "kode":"1","nama":"test1"}, { "kode":"2","nama":"test2"} ] });*/ /** FORM ENTRY/EDIT MATA-KULIAH */ var stakreditasislta_form = new Ext.form.FormPanel({ xtype:'form', id: 'frm.stakreditasislta', buttonAlign: 'left', labelWidth: 150, labelAlign: 'right', bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri monitorValid: true, height: 200, width: 500, layout: 'form', frame: false, defaultType:'textfield', items: [ { id: 'tf.frm.kdstakreditasislta', fieldLabel: 'Kode', width: 150, allowBlank: false, },{ id: 'tf.frm.nmstakreditasislta', fieldLabel: 'Nama', width: 300, allowBlank: false, },{ xtype: 'textarea', id: 'ta.frm.deskripsi', fieldLabel: 'Deskripsi', width: 300, }], buttons: [{ text: 'Simpan', iconCls:'silk-save', handler: function() { fnSaveStakreditasislta(); } }, { text: 'Kembali', iconCls:'silk-arrow-undo', handler: function() { wStakreditasislta.close(); } }] }); var wStakreditasislta = new Ext.Window({ title: winTitle, modal: true, closable:false, items: [stakreditasislta_form] }); /** CALL SET FORM AND SHOW THE FORM (WINDOW) */ setStakreditasisltaForm(isUpdate, record); wStakreditasislta.show(); /** FORM FUNCTIONS */ function setStakreditasisltaForm(isUpdate, record){ var kdprodi = RH.getCompValue('cb.prodi-matkul', true); if(isUpdate){ if(record != null){ //RH.disableComp('tf.frm.kdstakreditasislta'); RH.setCompValue('tf.frm.kdstakreditasislta', record.data['kdstakreditasislta']); RH.setCompValue('tf.frm.nmstakreditasislta', record.data['nmstakreditasislta']); RH.setCompValue('ta.frm.deskripsi', record.data['deskripsi']); return; } } } function fnSaveStakreditasislta(){ var idForm = 'frm.stakreditasislta'; var sUrl = BASE_URL +'stakreditasislta_controller/insert_stakreditasislta'; var sParams = new Object({ kdstakreditasislta : RH.getCompValue('tf.frm.kdstakreditasislta'), nmstakreditasislta : RH.getCompValue('tf.frm.nmstakreditasislta'), deskripsi : RH.getCompValue('ta.frm.deskripsi'), }); var msgWait = 'Tunggu, sedang proses menyimpan...'; var msgSuccess = 'Tambah data berhasil'; var msgFail = 'Tambah data gagal'; var msgInvalid = 'Data belum valid (data primer belum terisi)!'; if(isUpdate){ sUrl = BASE_URL +'stakreditasislta_controller/update_stakreditasislta'; sParams.idstakreditasislta = record.data['idstakreditasislta']; msgSuccess = 'Update data berhasil'; msgFail = 'Update data gagal'; } //call form grid submit function (common function by RH) RH.submitGridForm(idForm, sUrl, sParams, grid, wStakreditasislta, msgWait, msgSuccess, msgFail, msgInvalid); } }