In the easyui datagrid, what should I do if I click a column to trigger custom events in both onClickRow and one column ?, Easyuionclickrow

Source: Internet
Author: User

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 ;});}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.