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 = ''; return str; }}
This line of code is under the columns attribute Defined, and must add this code
onLoadSuccess:function(data){ $("a[name='opera']").linkbutton({text:'下订单',plain:true,iconCls:'icon-add'}); },
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!