JQuery Easyui Right-click problem on DataGrid data row

Source: Internet
Author: User

Such as:

I want to view the value of the row on the right-hand side of a single row of data (such as ID 20), code:

JavaScript Code
<script type= "Text/javascript" >$(function(){    $(' #test '). DataGrid ({title:' DataGrid data List ', Iconcls:' Icon-grid ', Fit:true, Collapsible:true, closable:true, nowrap:false, animate:true, URL:' <%=rootpath%>data/getjobs ', IDfield:' ID ', pagination:true, PageSize:20, pagelist: [10,20,30,40,50,100], Onrowcontextmenu:onrowcontextmenu,//right-click. [Table Header (tab) right Onheadercontextmenu, tree) right OnContextMenu]Rownumbers:true, Singleselect:true, columns:[[{title:", field: ' CK ', Width:120,checkbox:true}, {field:' id ', title: ' Job ID ', width:80}, {field:' Job_name ', title: ' Job name ', width:80}, {field:' Dat ', title: ' Entry Date ', Width:80,align: ' Right '}, {field:' Work_address ', title: ' Work place ', width:80}, {field:' Salary ', title: ' Salary ', width:80,align: ' Right '}, {field:' Status ', title: ' State ', width:60},]], onloadsuccess:function() {            Delete$( This). DataGrid (' Options '). queryparams[' id ']; }            });});</script>

Right-click menu:

xml/html Code
<DivID= "MM"class= "Easyui-menu"style= "width:120px;">    <DivOnClick= "view ()"data-options= "Iconcls: ' Icon-search '">View</Div>    <DivOnClick= "Add ()"data-options= "Iconcls: ' Icon-add '">New</Div>    <DivOnClick= "edit ()"data-options= "Iconcls: ' Icon-edit '">Edit</Div>    <DivOnClick= "del ()"data-options= "Iconcls: ' Icon-remove '">Delete</Div>    <Divclass= "Menu-sep"></Div>    <DivOnClick= "Print ()"data-options= "Iconcls: ' Icon-print '">Print</Div>    <DivOnClick= "reload ()"data-options= "Iconcls: ' Icon-reload '">Refresh</Div></Div>

Javascript:

//Add right-click menu ContentsfunctionOnrowcontextmenu (E, RowIndex, RowData) {e.preventdefault (); varselected=$ ("#test"). DataGrid (' GetRows ');//get all Rowset objects     varIdvalue =selected[rowindex].id; $( This). DataGrid (' Selectrecord ', idvalue);//Select a row by getting the value of the ID to make the parameter$ (' #mm '). Menu (' Show '), {left:e.pagex, top:e.pagey}); }//View Detailsfunctionview () {/** * This is where you get a single-line data method???? Treegrid is a good implementation: var node = $ (' #datagrid '). Treegrid (' getselected '); if (node) {...} ***/}

JQuery Easyui Right-click problem on DataGrid data row

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.