彈出datagrid內容的dialog框
版權宣告:本文為博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/qq_36092584/article/details/52674433
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" onclick="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" onclick="risk_suit_list_tool.add();">新增</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload" plain="true" onclick="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。
--------------------- 作者:thankjj20160909 來源:CSDN 原文:https://blog.csdn.net/qq_36092584/article/details/52674433?utm_source=copy 版權宣告:本文為博主原創文章,轉載請附上博文連結!