1.定義toolbar方法
pagination : true, pageSize : 10, pageList : [ 5, 10, 15, 20, 50 ], toolbar : toolbarFtt()
2.定義新增方法
function toolbarFtt() { if (top.checkRole([ 'LOCK_FORFEITRUE' ])) { return [ { text : '繳納保證金', iconCls : 'icon-add', handler : gridAdd } ] } }
3.新增方法的具體實現
function gridAdd() { var dlg = $('#mydialog').dialog({ title : '繳納保證金', left:"30%", top:"20%", buttons : [ { text : "確認支付", handler : function() { confirmSubmit(); } }, { text : "關閉", handler : function() { dlg.dialog('close'); } } ] }); $('#myform').form('reset'); getPayedWay();//支付方式處理 getAgency();//查詢所有的市場機構id和名稱 $('#mydialog').dialog('open'); // 打開窗口 }
4.
function confirmSubmit() { if($('#bailClass').combobox('getValue')==1){ //默認選中第一個 $('#agencyId').combobox('setValue',0); } if ($('#myform').form('validate')) { $.ajax({ type : "POST", url : top.baseUrl + 'customer/bail/charge', data : $('#myform').serialize(), dataType : 'json', success : function(result) { $('#mydialog').dialog('close'); $('#gridTable').datagrid('reload'); $('#gridTable').datagrid('unselectAll'); $.messager.show({ title : '提示信息!', msg : '操作成功!' }); }, error : function(result) { } }); } }