function grid_riwayatdos(nidu){ //COMMON STORE var ds_jstudi = sore_jstudi(); var objStores = new Object({ jstudi : ds_jstudi }); /** STORE RIWAYATPDK */ var fields_his = RH.storeFields('nmprodi','nmjenjangstudi','idriwayatpdkdosen','nidu', 'nourut','kdjenjangstudi','gelarakademik','kdpt','nmpt','kdbdgilmu','nmbdgilmu', 'kotapt','kdnegara','nmnegara','tglijazah'); var pageSize = 10; //DATA SOURCE var ds_his = RH.JsonStore({ url : BASE_URL + 'dosen_controller/get_riwayatpdk_dos', fields : fields_his, limit: pageSize, enableSearch: true, }); ds_his.setBaseParam('nidu', nidu); //SEARCH COMPONENT var sb_his = RH.searchComp({ id : 'sb_his', fields : ['nmpt:Perguruan Tinggi','kotapt:Kota','kdjenjangstudi:Jenjang Studi'], selected : 'nmpt', store : ds_his }); //COLUMN MODEL var cm_his = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header: 'Perguruan Tinggi', width: 150, dataIndex: 'nmpt', sortable: true }, { header: 'Kota', width: 120, dataIndex: 'kotapt', sortable: true }, { header: 'Negara', width: 120, dataIndex: 'nmnegara', sortable: true }, { header: 'Bidang Ilmu', width: 150, dataIndex: 'nmbdgilmu', sortable: true }, { header: 'Jenjang
Studi', width: 80, dataIndex: 'nmjenjangstudi', sortable: true }, { header: 'Tanggal
Ijazah', width: 90, dataIndex: 'tglijazah', align:'center', sortable: true }, RH.EditColumn(), RH.DeleteColumn() ] ); //GRID PANEL var gp_his = RH.GridPanel_T1({ ds: ds_his, cm: cm_his, singleSelect: true, searchComp: sb_his, allowAdd: true, fnAdd: fnAddRiwayat, pageSize: pageSize, cellclick: onCellClick, forceFit: true, autoScroll:true, autoWidth: true, height: 300, columnLines: true, loadMask: true, frame: true, listeners: { cellclick: onCellClick } }); return gp_his; function fnAddRiwayat(){ wform_riwayatdos(false, nidu, gp_his, null, objStores); } function onCellClick(grid, rowIndex, columnIndex, e) { var record = grid.getStore().getAt(rowIndex); // Get the Record RH.EditClick(e, function(){fnEditRiwayat(grid, record)}); RH.DeleteClick(e, function(){fnDeleteRiwayat(grid, record)}); } function fnEditRiwayat(grid, record){ wform_riwayatdos(true, nidu, grid, record, objStores); } function fnDeleteRiwayat(grid, record){ var url = BASE_URL + 'dosen_controller/delete_riwayatpdk'; var params = new Object({ idriwayatpdkdosen : record.data['idriwayatpdkdosen'] }); RH.deleteGridRecord(url, params, grid ); } /* var tabPanel = Ext.getCmp('tp.dosTabs'); var tabid = 'tab.history-dos'; var tab = Ext.getCmp(tabid); if(tab) { tab.removeAll(); tab.enable(); tab.add(gp_his); //tabPanel.setActiveTab(tab); return; //if exist return, code below not executed } //Code below is ecxecuted if the tab with idTab not found var tab = new Ext.Panel({ id: tabid, title: 'Riwayat Pendidikan', autoScroll:true, layout:'fit', closable:false, frame:true, items: [gp_his], }); tabPanel.add(tab); tab.doLayout(); tabPanel.doLayout(tab); //tabPanel.setActiveTab(tab); */ } function wform_riwayatdos(isEdit, nidu, grid, record, objStores){ var winTitle = 'Detail Riwayat Pendidikan Dosen ' + ((isEdit)?'(Edit)':'(Tambah)'); var ds_jstudi = objStores.jstudi; var fpRiwayat = new Ext.form.FormPanel({ //xtype: 'form', id: 'fpRiwayat', layout: 'form', width: 600, autoHeight:true,// //Height: 480, labelWidth: 130, labelAlign: 'right', frame: false, bodyStyle: 'padding:15px 15px 15px 15px', // atas, kanan, bawah, kiri items: [ RH.Lookup2Field({ label: 'Perguruan Tinggi', codeId:'lu.kdpt', nameId:'lu.nmpt', widths: [80,300], codeVisible: true, fnLookup: function(){wLookup(lu_univ, 'Perguruan Tinggi','lu.kdpt','lu.nmpt', 400, 450) } }), RH.Lookup2Field({ //PRODI / BIDANG ILMU label: 'Bidang Ilmu', codeId:'lu.kdprodi', nameId:'lu.nmprodi', widths: [80,300], codeVisible: true, fnLookup: function(){wLookup(lu_prodi, 'Bidang Ilmu','lu.kdprodi','lu.nmprodi', 600, 450) } }), { xtype: 'textfield', id: 'tf.kotastudi', fieldLabel: 'Kota', submitValue: true, width: 250, allowBlank: false }, RH.Lookup2Field({ label: 'Negara', codeId:'lu.kdnegara', nameId:'lu.nmnegara', widths: [0,200], codeVisible: false, fnLookup: function(){wLookup(lu_negara, 'Negara','lu.kdnegara','lu.nmnegara',320,450) } }), { xtype: 'combo', id: 'cb.jenjangstudi', fieldLabel: 'Jenjang Studi', width: 150, editable: false, allowBlank: false, store: ds_jstudi, triggerAction: 'all', valueField: 'kode', displayField: 'nama', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', //selectOnFocus:true, }, { xtype: 'textfield', id: 'tf.gelarakademik', fieldLabel: 'Gelar Akademik', submitValue: true, width: 250, //allowBlank: false }, /* //BIDANG-ILMU == PRODI ?? RH.Lookup2Field({ label: 'Kelompok Bidang Ilmu', codeId:'lu.kdbdgilmu', nameId:'lu.nmbdgilmu', widths: [0,300], codeVisible: false, fnLookup: function(){wLookup(lu_kelbid, 'Kelompok Bidang Ilmu','lu.kdbdgilmu','lu.nmbdgilmu') } }), */ { xtype: 'datefield', id: 'df.tglijazah', fieldLabel: 'Tanggal Ijazah', value: new Date(), width: 100 }] }); //); var winRiwayat = new Ext.Window({ title: 'Form Riwayat Pendidikan Dosen', modal: true, //layout: 'fit', width: 610, Height: 500, resizable: false, closable: false, items: [fpRiwayat], bbar: [ { xtype: 'button', text: 'Simpan', iconCls: 'silk-save', handler: function(){ fnSaveRiwayat()} } , { xtype: 'button', text: 'Kembali', iconCls: 'silk-arrow-undo', handler: function(){winRiwayat.close();} } ], }); setRiwayatpdkForm(isEdit, record); winRiwayat.show(); function setRiwayatpdkForm(isEdit, record){ if(isEdit){ if(record != null){ RH.setCompValue('lu.kdpt', record.data['kdpt']); RH.setCompValue('lu.nmpt', record.data['nmpt']); RH.setCompValue('lu.kdprodi', record.data['kdbdgilmu']); RH.setCompValue('lu.nmprodi', record.data['nmbdgilmu']); RH.setCompValue('tf.kotastudi', record.data['kotapt']); RH.setCompValue('lu.kdnegara', record.data['kdnegara']); RH.setCompValue('lu.nmnegara', record.data['nmnegara']); RH.setCompValue('cb.jenjangstudi',record.data['kdjenjangstudi']); RH.setCompValue('tf.gelarakademik', record.data['gelarakademik']); RH.setCompValue('df.tglijazah', record.data['tglijazah']) return; } } } function fnSaveRiwayat(){ var idForm = 'fpRiwayat'; var sUrl = 'dosen_controller/insert_riwayatpdk'; var sParams = getInsertRiwayatParams(); 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(isEdit){ sUrl = 'dosen_controller/update_riwayatpdk'; sParams.idriwayatpdkdosen = record.data['idriwayatpdkdosen']; msgSuccess = 'Update data berhasil'; msgFail = 'Update data gagal'; } //call form grid submit function (common function by RH) RH.submitGridForm(idForm, sUrl, sParams, grid, winRiwayat, msgWait, msgSuccess, msgFail, msgInvalid); } // GET PARAMETERS FOR INSERT/UPDATE function getInsertRiwayatParams(){ return new Object({ nidu : nidu, nourut : '', //varchar(1) in riwayatpdkdosen kdjenjangstudi : RH.getCompValue('cb.jenjangstudi'), gelarakademik : RH.getCompValue('tf.gelarakademik'), kdpt : RH.getCompValue('lu.kdpt'), nmpt : RH.getCompValue('lu.nmpt'), kdbdgilmu : RH.getCompValue('lu.kdprodi'), nmbdgilmu : RH.getCompValue('lu.nmprodi'), kotapt : RH.getCompValue('tf.kotastudi'), kdnegara : RH.getCompValue('lu.kdnegara'), tglijazah : RH.getCompValue('df.tglijazah'), }); } }