天天看点

jquery ezUI 双击行记录弹窗查看明细

第一步:给datagrid绑定ondblclickrow事件;

<table title="" id="datatable" class="easyui-datagrid" style="height: 500px;" data-options="

 url: '/ajaxget.aspx?_t='+new date().gettime()+'&_action=svngethandler.getsearchpagedata&searchtype=&keyword=*',

 method: 'get', 

 rownumbers: true,

 singleselect:true,

 border:0, 

 idfield: 'id', 

 columns:[[ 

     {field:'projectid',title:'项目id',width:30,align:'left'},

     {field:'projectname',title:'项目名称',width:150,align:'left'},

     {field:'projectnum',title:'项目编号',width:100,align:'left'}

 ]],

 toolbar:'#mytoolbar', 

 pagination:true,

 fitcolumns: true,

 pagesize:20, 

 ondblclickrow:ondblclickrow

 ">

 </table>

第二步:编写行双击事件

//行双击事件

function ondblclickrow() {

var item = $('#datatable').datagrid("getselected");

if (item != null) {

editid = item.id;

var html = "";

html += "项目名称:" + item.projectname + "<br/>";

html += "项目编号:" + item.projectnum + "<br/>";

html += "<br/>"; 

show(item.projectname + " 项目详情", html); 

}

第三步:弹出窗口显示详细信息:

<div id="details" style="padding: 10px;line-height:20px;font-size:12px"></div>

function show(title, msg) { 

$('#details').html("<div id=\"output\" style=\"width:99%;height:96%;border:0\">" + msg + "</div>");

$('#details').dialog({

title: title,

width: 800,

height: 400,

iconcls: 'icon-custom-eye',

closed: false,

cache: false,

modal: true

});

继续阅读