弹出datagrid内容的dialog框

js:

$(function () {
    $('#risk_suit_list').datagrid({
        queryParams: '',
        url: 'risk/suitlistrest.htm',
        fit: true,
        fitColumns: true,
        striped: true,
        nowrap: true,
        rownumbers: true,
        border: false,
        showPageList: false,
        pagination: true,
        singleSelect: true,
        toolbar: '#risk_suit_list_tool',

        onDblClickRow: function (index, row) {
            $("#risk_suit_list").datagrid('selectRow', index);
            var row = $("#risk_suit_list").datagrid('getSelected');
            if (row) {
                $("#main_window_dialog").dialog({
                    top: 150,
                    width: 700,
                    height: 400,
                    title: '详细信息',
                    href:  'risk/suitdetail.htm?suitId=' + row.id,
                    buttons: [
                        {
                            text: '确定',
                            handler: function () {
                                $('#main_window_dialog').dialog('close');
                            },

                        }]
                });
            }
        },
        columns: [[
            // {field: 'id', checkbox: true, width: 70, halign: "center", align: "center"},
            {field: 'suitName', title: '题套名字', width: 70, halign: "center", align: "center"},
            {
                field: 'appSubmitTime',
                title: '提交时间',
                width: 50,
                halign: "center",
                align: "center",
                formatter: formatDatebox
            },
            {field: 'appOperatorName', title: '提交人', width: 50, halign: "center", align: "center"},
            {field: 'enable', title: '是否选用', width: 50, halign: "center", align: "center",
                formatter: function (value, row, index) {
                    if (value == true) {
                        return '是';
                    }
                }
            },
            {
                field: 'appStatus', title: '当前状态', width: 50, halign: "center", align: "center",
                formatter: function (value, row, index) {
                    if (value == 10 || value == "") {
                        return '待审核';
                    }
                    else if (value == 30) {
                        return '审核通过';
                    }
                    else if (value == -30) {
                        return '审核未通过';
                    }
                }
            },
            {
                field: '操作', title: '操作', width: 100, halign: "center", align: "center",
                formatter: function (value, row, index) {
                    if (row.ICONCLS && row.ICONCLS.length > 0) {
                    } else {
                        var s = '';

                        if (row.appStatus == 10) {
                            s += '<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" οnclick="risk_suit_list_tool.review(' + index + ');" style="color:#75b7ff;">审核</a>';
                        } else {
                            // s += '      ';
                        }

                        return s;
                    }
                }
            }
        ]]
    });
关键代码:
// 弹出框的问题数据加载
    $('#<span style="color:#FF0000;">question_list_select_table</span>').datagrid({
        url:'risk/questionlistrest.htm',
        fit : true,
        fitColumns : true,
        striped : true,
        border : false,
        singleSelect:false,
        columns : [[
            {field: 'id', checkbox: true, width: 70, halign: "center", align: "center"},
            {field: 'content', title: '题目', width: 300, halign: "center", align: "center"},
        ]],
    });
    
    risk_suit_list_tool = {
        reload: function () {
            $('#risk_suit_list').datagrid('reload');
        },
        

        //按钮添加题套
        add: function () {
            $('#<span style="color:#FF0000;">question_list_select_dialog</span>').dialog({
                top: 150,
                width: 570,
                height: 400,
                title: '选择题目',
                closed: false,
                cache: false,
                modal: true,
                buttons: [{
                    text: '下一步',
                    handler: function () {
                        var ids = [];
                        var rows = $('#question_list_select_table').datagrid('getSelections');
                        for (var i = 0; i < rows.length; i++) {
                            ids.push(rows[i].id);
                        };
                        $('#main_window_dialog').dialog({
                            top: 150,
                            width: 570,
                            height: 400,
                            href: 'risk/toaddsuit.htm?ids='+ids,
                            title: '添加套题',
                            buttons: [{
                                text: '确定添加',
                                handler: function () {
                                    $('#risk_suit_add').form('submit', {
                                        url: 'risk/addsuit.htm',
                                        iframe: false,
                                        onSubmit: function (param) {
                                            param.questionIds = $('input[name="questionId"]').map(function () {
                                                return $(this).val();
                                            }).get().join(", ");
                                            param.questionOrders = $('input[name="questionOrder"]').map(function () {
                                                return $(this).val();
                                            }).get().join(", ");
                                            param.scores = $('input[name="score"]').map(function () {
                                                return $(this).val();
                                            }).get().join(", ");
                                            // return $(this).form('validate');
                                        },
                                        success: function (data) {
                                            $('#main_window_dialog').dialog('close');
                                            $('#risk_question_list').datagrid('clearSelections');
                                            if ($('#risk_suit_list').length > 0) {
                                                $('#risk_suit_list').datagrid('reload');
                                            }
                                        }
                                    })
                                }
                            },{
                            text: '取消',
                                handler: function () {
                                    $('#main_window_dialog').dialog('close');
                                }
                            }]

                        }),
                        $('#question_list_select_dialog').dialog('close');

                    }
                },
            });    

        },
}
jsp:
<div id="risk_suit_list_tool" style="padding:5px;">
        <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" οnclick="risk_suit_list_tool.add();">添加</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload" plain="true" οnclick="risk_suit_list_tool.reload();">刷新</a>
</div>
<div id="risk_suit_list"></div>

<div id="question_list_select_dialog">
        <!--问题列表的datagrid-->
        <table id="question_list_select_table"></table>
</div>

其实最主要的就是用一个div包着一个table,table其实就是一个datagrid,然后div是一个dialog。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值