Home > Web Front-end > JS Tutorial > body text

Detailed example of adding operation buttons to each row of data in EasyUI's DataGrid

小云云
Release: 2017-12-30 14:35:46
Original
7858 people have browsed it

Easyui's datagrid adds an operation button after each column of data. How to implement this function? The editor below brings you the implementation code of adding operation buttons for each row of data in EasyUI's DataGrid. Friends who need it can refer to it. I hope it can help you.

In fact, it is very simple to add a row of custom columns. When declaring the datagrid in js, add the following code


{field:'operate',title:'操作',align:'center',width:$(this).width()*0.1, 
  formatter:function(value, row, index){ 
    var str = &#39;<a href="#" rel="external nofollow" name="opera" class="easyui-linkbutton" ></a>&#39;; 
    return str; 
}}
Copy after login

This line of code is under the columns attribute Defined, and must add this code


onLoadSuccess:function(data){  
    $("a[name=&#39;opera&#39;]").linkbutton({text:&#39;下订单&#39;,plain:true,iconCls:&#39;icon-add&#39;});  
},
Copy after login

If you don’t add this, the button style will not appear in the operation column, just a hyperlink, use linkbutton or Other buttons can be adapted according to needs

The final effect is as follows

After that, you can do onclick events for the a tag, depending on the situation

Related recommendations:

Detailed explanation of Datagrid in EasyUi control

Detailed explanation of EasyUI's DataGrid binding Json data source method

EasyUI dataGrid inline editing

The above is the detailed content of Detailed example of adding operation buttons to each row of data in EasyUI's DataGrid. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template