• ajax动态刷新下拉框


    动态post,避免直接给页面传输大量数据

    /**
    	 * ajax通过商品刷新供应商
    	 * by_kangyx
    	 * @throws IOException 
    	 */
    	@RequestMapping(params = "actionMethod=refreshGoodRefSuppliers",method = RequestMethod.POST)
    	public void refreshGoodRefSuppliers(final Model model,
    			final HttpServletRequest request, final HttpServletResponse response) throws IOException{
    		//定义返回字符串
    	    StringBuffer strBuffer = new StringBuffer("");
    		String goodId = request.getParameter("goodId");
    		strBuffer.append("<option value=''>---请选择---</option>");
    		List<GoodRefSuppliers> goodRefSuppliersList = baseSupplierService.getGoodRefSuppliers(Long.valueOf(goodId));
    		for(int i=0;i<goodRefSuppliersList.size();i++){
    			strBuffer.append("<option value ='"+goodRefSuppliersList.get(i).getSuppliers().getId()+"'>"+goodRefSuppliersList.get(i).getSuppliers().getName()+"</option>");
    		}
    		Util.printString(response, strBuffer.toString());
    	}
    
                                    <td>
    			        <select name="goodRefSuppliers" id="goodRefSuppliers_${s.index}"
    			        onchange="setSuppliers(this.value,${orderdetail.id});" 
    			        onkeydown="refreshGoodRefSuppliers(${orderdetail.prdInfo.goodsInfo.id},${s.index});"
    			        onmousedown="refreshGoodRefSuppliers(${orderdetail.prdInfo.goodsInfo.id},${s.index});">    
    			        <option value="">--请选择--</option>
    			        </select>
    			         </td>
    
    	function refreshGoodRefSuppliers(id,ip){
    		switchData('logisticsOrders.do?actionMethod=refreshGoodRefSuppliers&goodId='+id,'',function(data,flag){
    			if(flag==1){
    				if(data!=""){
    					$("#goodRefSuppliers_"+ip).empty().append(data);
    	
    				}
    			}
    		});
    	} 
    
  • 相关阅读:
    数据结构—链表
    python字母串查找基本操作
    python九九乘法表程序代码
    SpringMVC跨域问题排查以及源码实现
    深入理解MySql子查询IN的执行和优化
    Dubbo源码阅读-服务导出
    Disconf源码分析之启动过程分析下(2)
    Disconf源码分析之启动过程分析上(1)
    Java多线程volatile和synchronized总结
    Java多线程基础总结
  • 原文地址:https://www.cnblogs.com/kyxyes/p/3650343.html
Copyright © 2020-2023  润新知