function pJadwal_kuliah(){ /** COMMON STORES */ var ds_prodireg = store_prodireg(); var ds_stsmt = store_stsmt(); /** GRID STORE: ds_jadwalkul */ var fields_jadwalkul = RH.storeFields('kdprodi','kdstsemester','kdmk','nmmkind','idsemester','nmruangan','waktu', 'jmlsks','nidu','nmdosdgngelar','idsemester','nmprodi','darijam','sampaijam','nmhari','nmasisten','nmdosen','idkelas','nmkelas'); var pageSize = 10; var ds_jadwalkul = RH.JsonStore({ url : BASE_URL + 'jadwalkul_controller/get_jadwalkul', fields : fields_jadwalkul, //limit : pageSize, params: [ {key:'kdprodi', id: 'cb.prodi-stru'} ,{key:'kdstsemester', id: 'cb.smt-stru'} ], enableSearch: true, }); ds_jadwalkul.on('beforeload', function(){ RH.removeDetail('fp.detil') }); //SEARCH COMPONENT var sb_jadwalkul = RH.searchComp({ id : 'sb_jadwalkul', fields : ['nmhari:Hari','kdmk:Kode Mata Kuliah','nmmkind:Nama Mata Kuliah','waktu:Waktu','nmkelas:Kelas', 'nmdosdgngelar:Dosen'], selected : 'kdmk', store : ds_jadwalkul, textWidth : 250, }); var ds_search = new Ext.data.JsonStore({ //static data autoDestroy: true, fields: [ 'field', 'value' ], data: [ { "field":"Hari","value":"nmhari"}, { "field":"Kode Mata Kuliah","value":"kdmk"}, { "field":"Nama Mata Kuliah","value":"nmmkind"}, { "field":"Tanggal","value":"tglujian"}, { "field":"Waktu","value":"waktu"}, { "field":"Kelas","value":"nmkelas"}, { "field":"Dosen","value":"nmdosdgngelar"} ] }); /** GRID COLUMN MODEL */ var cm_jadwalkul = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer({ width:35 }), //for rows numbering { header: RH.h3('Hari','c'), width:70, dataIndex: 'nmhari', sortable: true }, { header: RH.h3('Waktu'), width:120, dataIndex: 'waktu', sortable: true },{ header: RH.h3('Ruang'), width:150, dataIndex: 'nmruangan', sortable: true },{ header: RH.h3('Kode','c'), width:70, dataIndex: 'kdmk', sortable: true }, { header: RH.h3('Mata Kuliah'), width: 250, dataIndex: 'nmmkind', sortable: true, },{ header: RH.h3('Semester'), width:80, dataIndex: 'idsemester', hidden: true, sortable: true },{ header: RH.h3('Kelas'), width:120, dataIndex: 'nmkelas', sortable: true },{ header: RH.h3('SKS'), width: 40, dataIndex: 'jmlsks', align:'center', sortable: true, },{ header: RH.h3('Dosen'), width: 250, dataIndex: 'nmdosdgngelar', sortable: true, }, { header: RH.h3('Asisten'), width: 250, dataIndex: 'nmasisten', sortable: true, }] ); // Selection Model var sm_jadwalkul = new Ext.grid.RowSelectionModel({ singleSelect: true }); // Grid View var gv_jadwalkul = new Ext.grid.GridView({emptyText: '< Belum ada Data >'}); /** GRID PANEL */ var gp_jadwalkul = new Ext.grid.EditorGridPanel({ //PAKE EditorGridPanel ds: ds_jadwalkul, cm: cm_jadwalkul, sm: sm_jadwalkul, view: gv_jadwalkul, clicksToEdit: 1, //for cell editing (single click =1, dblclick=2) forceFit: true, //autoHeight: true, layout:'anchor', //autoSizeColumns: true, //autoExpandColumn: 'nmmkind', autoScroll:true, //enableColumnResize: true, columnLines: true, loadMask: true, tbar:[{ xtype: 'combo', fieldLabel: '', width:150, id:'cb.search', autoWidth: true, store: ds_search, valueField: 'value', displayField: 'field', editable: false, allowBlank: true, triggerAction: 'all',forceSelection: true, submitValue: true, mode: 'local', emptyText:'Cari berdasarkan ...', },{ xtype: 'textfield', id: 'tf.search', margins:'0 0 0 5', width:150, },{ xtype: 'button', id: 'bsearch', margins:'0 0 0 5', iconCls: 'silk-zoom', handler: function() { if(RH.isEmpty('cb.search')) return; ds_jadwalkul.reload({ params: { key: RH.getCompValue('cb.search'), value: RH.getCompValue('tf.search'), }, }); } }], /* bbar: new Ext.PagingToolbar({ store: ds_jadwalkul, displayInfo: true, pageSize: pageSize, mode: 'local', displayMsg: 'Data {0} - {1} dari {2}', emptyMsg: "Belum ada data" }) */ }); var fp_jadwalkul = new Ext.Panel({ xtype: 'form', title: 'Jadwal Kuliah', iconCls:'silk-book', buttonAlign: 'left', bodyStyle: 'padding: 5px', border: false, layout: 'border', waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, autoScroll:true, frame: true, items: [{ xtype: 'fieldset', flex: 1, region:'north', layout:'form', autoHeight:true, items: [{ xtype: 'container', layout: 'hbox', items:[{ layout:'form', labelWidth:90, labelAlign:'right', items: [ RH.ActionCombo({ id: 'cb.prodi-stru', label: 'Program Studi', width: 300, data: ds_prodireg, key: 'kdprodi', display: 'lnmprodi', fnSelect: function(){ reloadGridJadwalKul(); } }) ] },{ layout:'form', labelWidth:140, labelAlign:'right', items: [ RH.ActionCombo({ id: 'cb.smt-stru', label: 'Tahun Akademik', width: 160, data: ds_stsmt, key: 'kdstsemester', display: 'nmsmt', fnSelect: function(){ reloadGridJadwalKul(); } }) ] },{ xtype: 'textfield', id: 'hidden.kdmk', hidden:true, }] }] },{ region: 'center', layout:'form', autoScroll:true, items:[{ xtype: 'panel', layout:'fit', height:450, title:'Mata Kuliah', id:'fp.master', frame:true, items: [gp_jadwalkul], tbar: [{ text: 'Cetak', id: 'tb.add-stru', iconCls: 'silk-printer', handler: function(){ fnPrintJadwalkul(); } }] }], }] }); /** FUNCTIONS */ function fnPrintJadwalkul(){ var prodi = RH.getCompValue('cb.prodi-stru'); var tahun = RH.getCompValue('cb.smt-stru'); var key = RH.getCompValue('cb.search'); var value = RH.getCompValue('tf.search'); if(prodi && tahun){ RH.ShowReport(BASE_URL + 'rpt/rpt_jadwalkul/get_jadwal_kuliah/'+prodi+'/'+tahun+'/'+key+'/'+value); } else {} } function reloadGridJadwalKul(){ var prodi = RH.getCompValue('cb.prodi-stru'); var tahun = RH.getCompValue('cb.smt-stru'); //remove detail RH.removeDetail('fp.detil'); //reload master-grid if(prodi && tahun){ ds_jadwalkul.reload({ params: { kdprodi: RH.getCompValue('cb.prodi-stru', true), kdstsemester: RH.getCompValue('cb.smt-stru', true) } }); } } SET_PAGE_CONTENT(fp_jadwalkul); }