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