Ext bulk deletion

  • A simple little feature, batch delete data;

Checkbox

Here Insert Picture Description
Here Insert Picture Description

Deleting in a batch

Here Insert Picture Description
Here Insert Picture Description

{
			text : "批量删除",
			icon : jcapp.getIcon("application_form_delete.png"),
			handler : function() {
				var selModel = listGridPanel.getSelectionModel();
				if (selModel.hasSelection()) {
					var selected = selModel.getSelection();
					var ids=[];
					Ext.each(selected, function (item) {
						ids.push(item.data.POST_ID)
						myDel(ids)
					})
				}
			}
		}

Here Insert Picture Description

function myDel(ids) {
			alert(ids);
			Ext.Msg.confirm("提示:", "确定删除选定的记录?", function(e) {
				if (e == "yes") {
					for (var i = 0; i < ids.length; i++) {
					Ext.Ajax.request({
						url : getServerHttp("nh-asmt") +"/post/delete?PostId=" + ids[i],
						success : function(response) {
							var json = Ext.JSON.decode(response.responseText);
							Ext.Msg.alert("提示", json.result);
							dataStore.load();
						},
						failure : function(response) {
							Ext.Msg.alert("提示", "操作失败!");
						}
					});
				}
				}//#if
			});
		}//#myDel
Published 13 original articles · won praise 8 · views 1306

Guess you like

Origin blog.csdn.net/yaoliyuan0922/article/details/100779095