easyUi 页面创建一个toolbar实例

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) {
                
            }
        });

    }
}

 

posted @ 2016-12-24 11:37  Mr_伍先生  阅读(6307)  评论(0编辑  收藏  举报