In the easyui datagrid, what should I do if I click a column to trigger custom events in both onClickRow and one column ?, Easyuionclickrow
In the easyui datagrid, When you click a column to trigger custom events in both onClickRow and one of the columns, what should we do?
Solution:
My requirements are as follows:
When you click the easyui-datagrid row, the article content needs to be displayed in the pop-up box.
Click Download in a row to download
The problem is that the onClickRow event will also be triggered when you click Download.
So my solution is to set a variable to determine which event is triggered.
The Code is as follows:
// JQuery entry var SELECTDOCID = null; var ARTICL_CONTENT = null; var ISOneRow = 1; // determine whether a row of the datagrid is triggered. 1 indicates that a row is clicked, and 0 indicates that the hyperlink is clicked.
// Initialize the document management tab function Init_DocManagement () {// set multiple languages first // budget list description set title $ (". div_DocFileList "). panel ("setTitle", SYS_LANGUAGE.UI_LANGUAGE_JSON ['budget folder list']); // you can specify the multilingual title of a table $ ('# docList_Table '). datagrid ({singleSelect: true, fitColumns: true, columns: [[{field: 'doch', title: SYS_LANGUAGE.UI_LANGUAGE_JSON ['doch'], width: 150}, {field: 'docch', title: SYS_LANGUAGE.UI_LANGUAGE_JSON ['docch'], width: 150}, {field: 'docid', hidden: true, width: 150}, {field: 'docnr', hidden: true, width: 150}, {field: 'fjname', hidden: true, width: 150}, {field: 'doclow', title: SYS_LANGUAGE.UI_LANGUAGE_JSON ['doclow'], width: 150, formatter: function (value, row, index) {SELECTDOCID = row; return "<a href = 'javascript: void (0) 'onclick = 'Download () 'style = 'text-decoration: none'> download </a> ";}}], onClickRow: function (index, row) {if (ISOneRow = 1) {openArticle (row. DOCMC, row. DOCNR) ;}else {ISOneRow = 1 ;}}); // process data to load Init_DocTree ();}
// Download file function download () {// assign ISOneRow = 0 first; // alert (row. DOCID); var DOCID = SELECTDOCID. DOCID; var url = ".. /AjaxToWcf. ashx "; var serverParam = {docId: DOCID}; var ajaxParams = {serverUrl:" BS_DocumentManage/DownLoadFile ", serverParam: parent. JSON. stringify (serverParam), requestType: "POST", IsAsync: true, language: parent. SYS_LANGUAGE.SYS_LANGUAGE}; var names = []; parent. common AjaxRequest (url, ajaxParams, function (_ data) {Loaded (); var jsonData = parent. JSON. parse (_ data); // datagrid loading // $ ('# docList_Table '). datagrid ('loaddata', jsonData); names = jsonData. url; if (names. length <= 0) {$. messager. alert ('hprompt ', 'this document does not have an attachment', 'info'); return;} var str = names. join (','); window. location. href = ".. /DocumentManagement/DownFile. ashx? FileName = "+ str ;});}