标签:style blog http color os io for ar div
前端代码,将删除记录序列号组合成字符串传到后台
‘industryList button[action=deleteAll]‘ : { click : function(button){ // var agrid = button.findParentByType("gridpanel"); var agrid = button.ownerCt.ownerCt; var data = agrid.getSelectionModel( ).getSelection(); if(data.length == 0){ Ext.Msg.alert(‘警告‘,‘请选择记录‘); }else{ var mystore = agrid.getStore(); var aarray = [ ]; //序列号组合成字符串数组 Ext.Array.each(data,function(record){ var id = record.get(‘id‘); aarray.push(id.toString()); console.log(id.toString()); }); Ext.Ajax.request({ url:‘deleteAll.do‘,
//join()函数将
// 数组元素组合成长字符串ids传到后台 params:{ids:aarray.join(",")}, method:‘POST‘, timeout:2000, success:function(response,opts){ // Ext.Array.each(data,function(record){ // st.remove(record); // }) Ext.Msg.alert("删除操作","操作成功"); var pagingObj = Ext.getCmp(‘ptb‘); pagingObj.doRefresh(); } }); } } },
后端代码
@RequestMapping(value="/deleteAll",method=RequestMethod.POST) public void deleteAllIndustry(HttpServletRequest request,HttpServletResponse response){ String ids = request.getParameter("ids"); System.out.println(ids+"!!!!!!!!!!"+"deleteAll control层"); String[] tokens = ids.split(","); for(String s : tokens){ int p_key = Integer.valueOf(s); industryService.deleteIndustryById(p_key); } String msg = "{success : true}"; try { response.getWriter().write(msg); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
标签:style blog http color os io for ar div
原文地址:http://www.cnblogs.com/hzmbbbb/p/3936573.html