easyui实现input弹框选择数据

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
//引入jq和easyui的包
<link href="css/easyui.css" rel="stylesheet">
<script src="js/jquery.easyui.min.js"></script>
 <script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
<title>easyui</title>
</head>
<body>

<!-- easyui插件支持 -->
	<div id="busytypeSelectGridDialog" class="easyui-dialog" title="选择" buttons="#dlg-grid-buttons" resizable="true"
		data-options="iconCls:'icon-save'" closed="true" style="width:600px;height:400px;">
		<div id="dlg-grid-buttons">
			<a href="#" class="easyui-linkbutton" onclick="javascript:busytypeGridSelectOk();">确定</a>
			<a href="#" class="easyui-linkbutton" onclick="javascript:$('#busytypeSelectGridDialog').dialog('close')">关闭</a>
		</div>
		<table id="busytypeSelectGrid" singleSelect="true">
		</table>
	</div>




					<td class="c1" >
						easyui弹框:
					</td>
					<td>
                        <input type="text" id="easyui1" name = "easyui1" class = "easyui1" style="width:130px;"/>
					  <a href = "#" onclick="daoduan('dzkh')" id = "a1">选择</a>
                        
                    </td>
				</tr>
                   
			</table>
			</div>
        

<script type="text/javascript">
//表格单选
var selectData = []
 function daoduan(field){
 	var easyui1= $("#easyui1").val().trim();
 	var params = "";
 	$("td[width='23%'] input").each(function (index){
 		params += ($(ele).attr('id')+":"+$(ele).val()+";")
 	});
//这里填写你访问后台的链接
 	var procurl="easyui1?easyui1="+easyui1;
 	selectField = field;
 	if (true){
 		selectData[field] = $('#busytypeSelectGrid').datagrid({
 			url: procurl,
 			fitColumns:true,
 			onClickRow:function(row){
 				busytypeGridSelectOk();
 			},
//这个为弹出弹出表格的表头
 			columns:[[{field:'NAME',title:'名称',width:50},{field:'CODE',title:'代码',width:50}]]

 		});
 	}
 	
 	$('#busytypeSelectGridDialog').dialog('open');
 	var v = $('#'+field).val();
 	var node = $('#busytypeSelectGrid').datagrid('selectRecord', v);
 	if ( node){
 			$('#busytypeSelectGrid').datagrid('selectRecord', node.target);
 	}
 }
 
function busytypeGridSelectOk(){
	var row = $('#busytypeSelectGrid').datagrid('getSelected');
	var columns = (Object.getOwnPropertyNames(row));
//给input框赋值
	/* $('#easyui1').val(row.NAME);*/
	$('#'+selectField).val(row.NAME);
	for(var i=0; i<columns.length; i++){
		if('CODE' == columns[i] || 'TITLE' == columns[i]){
			continue;
		}else{
			$('#'+columns[i]).val(row[columns[i]]);
		}
	}
	$('#busytypeSelectGridDialog').dialog('close');	
}
 
</script>
</body>
</html>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值