When I was working on the project today, I wanted to add an operation button after each column of data in the DataGrid of easyUI. At the beginning, I wanted to splice strings in the background and return them with JSON. But after testing, I found that this method didn’t work. I searched the Internet and sorted them out as follows:
In fact, it’s very easy to add a row of custom columns. When JS declares DataGrid, add the following code
<span style="font-size:18px;">{field:'operate',title:'act',align:'center',width:$(this).width()*0.1,
formatter:function(value, row, index){
var str = '<a href="#" name="opera" class="easyui-linkbutton" ></a>';
return str;
}}</span>
This line of code is defined under the columns property, and it must be added
<span style="font-size:18px;">onLoadSuccess:function(data){
$("a[name='opera']").linkbutton({text:'buy',plain:true,iconCls:'icon-add'});
},</span>
If you don’t add this, there will be no button style in that operation column. It’s just a hyperlink. You can use LinkButton or other buttons according to your needs
Read More:
- [Solved] npm link Error: error Error: EPERM: operation not permitted;The operation was rejected by your operating
- Using for in loop complex data types (object and array) in ES6
- Asynchronous loading method of Baidu map
- If the request parameter is formdata, use the Ajax operation
- Javascript: Simple package localStorge operation
- [Solved] Error: EPERM: operation not permitted (Permissions issue)
- [Solved] JQuery each Method Error: $XXX is not defined
- Method to solve uncaught typeerror: cannot set property ‘onclick’ of null error
- [Solved] Internal Error: EPERM: operation not permitted, open
- [Solved] “npm WARN logfile could not be created: Error: EPERM: operation not permitted,…”
- [Solved] Error: #error More than 1 blank line not allowed no-multiple-empty-lines
- [Solved] Cnpm installation -g@ view/cli Error: error: eperm: operation not allowed…
- How to Fix “HTTP 405 method not allowed” Error
- [Solved] Vue3.2 component computed Error: Write operation failed: computed value is readonly
- [Solved] Element form method Error: TypeError: Cannot read properties of undefined (reading ‘resetFields’)
- Solving routing errors by rewriting Vue push method
- [Solved] Element form method resetfields() error: vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read properties of undefined (reading ‘indexOf’)
- [Solved] Binding onclick event in JS: for loop: error uncaught typeerror: cannot set properties of undefined (setting ‘classname’)
- [Solved] Error in mounted hook: “Error: please transfer a valid prop