Jquery-easyui Add Delete button for each row in DataGrid successfully deleted

Source: Internet
Author: User

<table id= "transferredviewtable" class= "Easyui-datagrid" >
	<thead>
	 <tr>
	  <th data-options= "field: ' Trastaid ', hidden:true" > Staff id</th>
	  <th data-options= "field: ' Trastaname '" > Name </th>
	  <th data-options= "field: ' Traorgid ', hidden:true" > Organization id</th> <th data-options=
	  "Field: ' Traorgname ', width:250" > Company Department </th>
	  <th data-options= "field: ' Operation ', width:100" > action </th>
	 </tr>
	</thead>
</table>

This is the JSP page.

$ ("#transferredViewTable"). DataGrid ({
	url:url,    //Here is a URL, the background transmits data
	collapsible:true,
	Singleselect:false,
	columns:[[{field: ' Trastaid ', hidden:true},
		{field: ' Trastaname ', title: ' Name '},
		{ Field: ' Traorgid ', hidden:true},
		{field: ' Traorgname ', title: ' Company department ', width:250},
		{field: ' Operation ', title: ' Operation ', width:100,
		formatter:function (value,rec,index) {
                              var del = ' <a href= ' # ' class= ' Easyui-linkbutton ' data-options= "Plain:true,iconcls:\ ' icon-remove\ '" onclick= "Deltransferredstaff (' +value+ ')" > Delete </a> ";
		              Return del;}
		]
});

function Deltransferredstaff (value) {   //Here is the delete operation, in fact I this deletion is not deleted in the background. The reload with the DataGrid has no effect on
	var index = $ ("#transferredViewTable"). DataGrid ("Getrowindex", value);  At the beginning, the Deltransferredstaff parameter is index, but if
	$ ("#transferredViewTable"). DataGrid ("DeleteRow", index);                The row number error occurs when there is data below the deleted row
}


If there is an error, you can bring it up. Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.