easyui鼠標雙擊事件,使用 onDblClickRow(index, row) 事件,在用戶雙擊一行的時候觸發,參數包括:
- index:點擊的行的索引值,該索引值從0開始。
- row:對應於點擊行的記錄。
$("#wu-datagrid-news").datagrid({ loadFilter: pagerFilter,//分頁 rownumbers: true,//如果為true,則顯示一個行號列。 singleSelect: false,//如果為true,則只允許選擇一行。 multiSort: true,//定義是否允許多列排序。 fitColumns: true,//真正的自動展開/收縮列的大小,以適應網格的寬度,防止水平滾動。 fit: true,//自適應 idField: 'id',//指明哪一個字段是標識字段 loadMsg: 'Processing, please wait …',//在從遠程站點加載數據的時候顯示提示消息。 pagination: true, //如果為true,則在DataGrid控件底部顯示分頁工具欄。
columns: [[{ field: 'id', //列字段名稱 width: '100', //列的寬度。如果沒有定義,寬度將自動擴充以適應其內容。 title: 'ID', //列標題文本 checkbox: true //復選框,該復選框列固定寬度。 }, { field: 'trainTitle', title: '標題', width: '300', align: 'center' }, { field: 'trainAuthor', title: '作者', width: '100', align: 'center' }, { field: 'trainBody', title: '正文', width: '500', align: 'center' }, { field: 'imgPath', title: '圖片', width: '80', align: 'center', hidden:'true'//此列隱藏 }, { field: 'createTime', title: '創建時間', width: '150', align: 'center' } ]], onDblClickRow:function(rowIndex){//鼠標雙擊事件 $("#wu-datagrid-news").datagrid("selectRow",rowIndex);//選中此行 var currentRow = $("#wu-datagrid-news").datagrid("getSelected");//獲得選中行的信息 //彈出框賦值 $("#newsTitle").val(currentRow["trainTitle"]); $("#newsAuthor").val(currentRow["trainAuthor"]); $("#newImg").attr('src',''); $("#newImg").attr('src',httpurl+'/'+currentRow["imgPath"]); $("#newsBody").val(currentRow["trainBody"]); $("#imgPath").hide(); $('#wu-dialog-news').dialog({//彈出框 closed: false, modal: true, title: "查看信息", buttons: [{ text: '確定', iconCls: 'icon-ok', handler: function () { $('#wu-dialog-news').dialog('close'); } }] }); } });