Share the post "Place A Delete Action Link In A Table Row In JEasyUI DataGrid"
To add an action similar to the image (edit, delete, save, cancel) above, add this table header tag within the table row tag.
|
1 |
<th width="100">Action</th> |
Now, in order for delete links to appear, you need to add a custom made Javascript function that has parameters ‘value, row and index’ and returns a string that dynamically creates an HTML hyperlink for the delete functionality.
|
1 2 3 |
function formatAction(value, row, index){ return '<a href="//" onclick="deleteRow(' + index + ')>Delete</a>'; } |
Lastly, you create another custom made function so that when the delete hyperlink is clicked, that function is called.
|
1 2 3 |
function deleteRow(index) { alert('Row ' + index + ' was clicked'); } |
