function u4() { var ds_otoritas= store_otoritas(); var oto = ''; var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'c_utility/g_OT', method: 'POST' }), params: { start: 0, limit: 5 }, root: 'data', totalProperty: 'results', //autoLoad: true, fields: [{ name: "idmenu", mapping: "idmenu" }, { name: "kdmenu", mapping: "kdmenu" }, { name: "nmmenu", mapping: "nmmenu" }, { name: "deskripsi", mapping: "deskripsi" }, { name: "idjnshirarki", mapping: "idjnshirarki" }, { name: "idstatus", mapping: "idstatus" }, { name: "men_idmenu", mapping: "men_idmenu" }, { name: "user_aktif", mapping: "user_aktif", type: 'bool' }] }); ds_grid.load({ callback: function() { // Ext.Msg.show({ // title: 'Perhatian', // msg: 'Silahkan Anda Pilih Kelompok Pengguna Diatas!?', // modal: true, // icon: Ext.Msg.INFO, // buttons: Ext.Msg.OK // }); Ext.getCmp('combox').focus(); } }); var vw = new Ext.grid.GridView({ emptyText: '< Otoritas Belum Dipilih >' }); var sm_nya = new Ext.grid.CheckboxSelectionModel({ listeners: { selectionchange: function(sm) { if (Ext.getCmp('combox').getValue() !="" || Ext.getCmp('combox').getValue() !="Pilih..."){ if (sm.getCount()) { var c = sm_nya.getSelected().data['user_aktif']; // alert(c); if (c == true) { //isi Ext.getCmp('aktiftbar').disable(); Ext.getCmp('noaktiftbar').enable(); } else { Ext.getCmp('aktiftbar').enable(); Ext.getCmp('noaktiftbar').disable(); } } else { Ext.getCmp('aktiftbar').disable(); Ext.getCmp('noaktiftbar').enable(); } } } } }); var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { sortable: true // columns are not sortable by default }, columns: [//sm_nya, { header: 'Kode', width: 45, dataIndex: 'kdmenu', sortable: true }, { header: 'Nama', width: 300, dataIndex: 'nmmenu', sortable: true }, { header: 'Deskripsi', width: 500, dataIndex: 'deskripsi', sortable: true }, { header: 'Hierarki', width: 50, dataIndex: 'idjnshirarki', sortable: true }, { header: 'Status', width: 50, dataIndex: 'idstatus', sortable: true }, { header: 'Submenu', width: 60, dataIndex: 'men_idmenu', sortable: true }, { xtype: 'checkcolumn', header: 'Status', dataIndex: 'user_aktif', id: 'user_aktif', width: 60, readonly: false, listeners: { rowClick: function() { // ds_grid().setBaseParam('dodol','b'); } }, editor:{ xtype: 'checkbox', id:'cbpilih', name:'cbpilih', listeners: { change: function() { } } } //sortable: true }] }); var cari_data = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 200 })]; var paging = new Ext.PagingToolbar({ pageSize: 50, store: ds_grid, displayInfo: true, displayMsg: 'Data Otoritas Dari {0} - {1} of {2}', emptyMsg: 'Data Otoritas Belum Dipilih.' }); var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_grid, frame: true, height: 530, autoScroll: true, autoWidth: true, plugins: cari_data, id: 'grid_det_product', forceFit: true, tbar: [ { text: 'Kelompok Pengguna', // iconCls: 'silk-printer' },{ xtype: 'combo', width: 200, height: 50, allowBlank: false, store: ds_otoritas, id: 'combox', name: 'combox', triggerAction: 'all', editable: false, valueField: 'idklppengguna', displayField: 'nmklppengguna', forceSelection: true, submitValue: true, hiddenName: 'h_combox', listeners: { select: function() { var isi = Ext.getCmp('combox').getValue(); if (isi){ Ext.getCmp('btn_simpan').enable(); } else { Ext.getCmp('btn_simpan').disable(); } ds_grid.setBaseParam('klppengguna', isi); ds_grid.load(); } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true },{ text: 'Aktif', id: 'aktiftbar', iconCls: 'silk-accept', disabled: true, hidden: true, handler: function() { //alert(USERNAME); oto = 'aktif'; verifyoto(); } }, { text: 'Non-Aktif', id: 'noaktiftbar', iconCls: 'silk-disaccept', disabled: true, hidden: true, handler: function() { //alert(USERNAME); oto = 'naktif'; verifyoto(); }, }, { text: 'Simpan', id: 'btn_simpan', iconCls: 'silk-accept', disabled:true, handler: function() { simpanotoritas(); } }], sm: sm_nya, vw: vw, autoScroll: true, cm: cm, bbar: paging, //autoExpandColumn: 'common', clicksToEdit: 1, listeners: { rowdblclick: function rowdblClick(grid, rowIdx) { var rec = ds_grid.getAt(rowIdx); alert(rec.data["kdmenu"] + ', ' + Ext.getCmp('combox').getValue()); // Ext.Ajax.request({ // method: 'POST', // url: BASE_URL + 'c_utility/u_OT', // params: { // bool: rec.data["user_aktif"], // kpengguna: Ext.getCmp('combox').getValue(), // kdmenu: rec.data["kdmenu"] // }, // success: function() { // ds_grid.load(); // alert('Data telah diupdate!?') // } // }); } } }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_bp_general_id', region: 'center', buttonAlign: 'left', bodyStyle: 'padding: 5px', border: false, disabled: true, title: 'Otoritas', waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, items: [{ layout: 'form', border: false, items: [grid_nya] }], listeners:{ afterrender:function(){ Ext.getCmp('combox').focus(); } } }); function simpan_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'c_utility/s_JKP', method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); ds_grid.load(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Gagal"); } }); } function hapus_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); Ext.MessageBox.show({ title: "Konfirmasi", msg: "Anda Yakin Untuk menghapus Data ini?", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { form_nya.getForm().submit({ url: BASE_URL + 'c_utility/d_JKP', method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Hapus Data Berhasil"); ds_grid.load(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Hapus Data Gagal"); } }); } } }) } function ubah_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); Ext.MessageBox.show({ title: "Konfirmasi", msg: "Anda Yakin Untuk Mengubah Data ini?", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { form_nya.getForm().submit({ url: BASE_URL + 'c_utility/u_JKP', params: { // kriteria: kriteria }, method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Berhasil"); ds_grid.load(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Gagal"); } }); } } }); } function verifyoto() { // var cannot= cek(sm_nya); // alert(cannot); // if(cannot==0){ Ext.MessageBox.show({ title: "Konfirmasi", width: 350, msg: "