function f_pengarang_form(id_module,ds) { var form_bp_general = new Ext.form.FormPanel({ border: false, id: 'form_bp_general', labelAlign: 'left', buttonAlign: 'right', bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri monitorValid: true, height: 200, width: 360, layout: 'form', reader: new Ext.data.JsonReader ({ root: 'data', totalProperty: 'results', id: 'id', fields: [ { name: "id_pengarang", mapping: "id_pengarang" },{ name: "kd_pengarang", mapping: "kd_pengarang" },{ name: "nama_pengarang",mapping: "nama_pengarang" } ] }), items: [ { xtype: 'textfield', fieldLabel: 'Kode Pengarang', labelStyle: 'width:140px', width:200, name: 'kd_pengarang' }, { xtype: 'textfield', fieldLabel: 'Nama Pengarang', labelStyle: 'width:140px', width:200, name: 'nama_pengarang' }, { xtype: 'textfield', fieldLabel: '', hidden:true, labelStyle: 'width:100px', width:240, name: 'id_pengarang' } ], buttons: [{ id:'btn_simpan', text: 'Simpan', iconCls: 'silk-save', handler: function() { if(id_module!=''){ ubah_grid('form_bp_general'); }else{ simpan_grid('form_bp_general'); } } }, { text: 'Kembali', handler: function() { win.close(); } } ],listeners:{ afterrender: module_afterrender } }); function module_afterrender(){ if(id_module!=""){ form_bp_general.getForm().load({ url: BASE_URL + 'e_katalog/c_pengarang/grid', params:{ id_module:id_module }, success: function(form, action){ }, failure: function(form, action){ Ext.MessageBox.alert('Failure', 'Fail to get data'); }, waitMsg:'Loading..' }); } } var win = new Ext.Window({ title: 'Tambah Pengarang', modal: true, items: [form_bp_general] }).show(); function simpan_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'e_katalog/c_pengarang/save', method: 'POST', params:{ // matas:Ext.getCmp('menuatas').getValue(), // mbawah:Ext.getCmp('menubawah').getValue(), // mkanan:Ext.getCmp('menukanan').getValue(), // mkiri:Ext.getCmp('menukiri').getValue() }, success: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); ds.load(); form_bp_general.getForm().reset(); Ext.getCmp('form_bp_general').enable(); Ext.getCmp('btn_simpan').enable(); // Ext.getCmp('btn_hapus').disable(); // Ext.getCmp('btn_ubah').disable(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Gagal"); } }); } function ubah_grid(namaForm) { // var msgplus; // if(kodex!=Ext.getCmp('kode').getValue()){ // msgplus='