jQuery MiniUI
标题:
mini-autocomplete控件
[打印本页]
作者:
都是问题
时间:
2019-10-21 11:02:05
标题:
mini-autocomplete控件
[attach]12496[/attach]mini-autocomplete控件为什么用js追加就会失效啊?
作者:
felt
时间:
2019-10-21 12:01:04
请贴出你的相关使用代码
作者:
都是问题
时间:
2019-10-21 12:39:23
felt 发表于 2019-10-21 12:01
请贴出你的相关使用代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>子单绑定</title>
</head>
<script type="text/javascript" src="../../../resources/jquery/jquery-2.1.3.min.js"></script>
<script src="../../../resources/miniui/miniui.js"></script>
<link rel="stylesheet" href="../../../resources/miniui/themes/default/miniui.css" />
<link rel="stylesheet" href="../../../resources/miniui/themes/icons.css" />
<link rel="stylesheet" href="../../../resources/static/css/xopt/public.css" />
<body>
<form id="form" method="post" style="width: 100%;height: 100%;">
<div>
<div>
<div style="margin-left: 13%;">
<table style="width:100%;">
<tr style="text-align:center;">
<td style="width:5%;" class="red">运单编号</td>
<td style="width:15%;text-align: left;">
<input id="loginname" name="loginname" class="mini-textbox" />
</td>
<td style="width:5%" class="red">子单编号</td>
<td style="width:15%;text-align: left;">
<input id="sonidcombo" textField="text" valueField="id" value="1" name="sonidcombo" data="sonidcomboxs" class="mini-combobox" />
</td>
<td style="width: 20%;text-align: left;">
<a class="mini-button" id="btnConfirm" onclick="addson()" iconCls="icon-addnew" style="width: 100px; margin-left: 85px;">
子单绑定</a>
</td>
</tr>
</table>
</div>
</div>
<div id="content">
<div id="mainCount">
</div>
<table style="width:100%;text-align: center;">
<tr style="height:60px;">
<td colspan="2">
<a class="mini-button" id="btnSave" onclick="btnsave()" iconCls="icon-save" style="width: 80px; margin-left: 85px;">保存</a>
<a class="mini-button" id="resetBtn" onclick="btnclose()" iconCls="icon-cancel" style="width: 80px; margin-left: 75px;">取消</a>
</td>
</tr>
</table>
</div>
<div id="tem" style="display: none;">
<div class="count">
<form id="form1" method="post" style="width: 100%;height: 100%;">
<div>
<fieldset id="forcontent" style="width:90%;border:solid 1px #aaa;margin-top:8px;position:relative;margin-left: 4%;margin-right: 5%;">
<div class="allcontent">
<div class="editForm" style="padding:5px;">
<input type="hidden" class="mini-hidden" name="id" />
<table style="width:100%;text-align: center;">
<tr>
<td rowspan="7" style="width:8%;height:160px;background-color: #99E0A3;">
<img src="../../../resources/static/img/timg.png" style="width: 60px;height: 60px;" class="" />
<div>新增子单</div>
</td>
<td style="width:15%" class=" red">子运单编号</td>
<td style="width:15%;text-align: left;"><input id="" name="" value="" class="mini-textbox hewb_no" /></td>
<input class="mini-autocomplete" id="test" style="width:150px;" textField="text" valueField="id" url="" value="cn" showNullItem="true" allowInput="true" onbeforeload="onload" />
<td style="width:15%" class=" red">物品名称</td>
<td style="width:15%;text-align: left;"><input id="" name="" class="mini-textbox goods_name" />
</td>
<td style="width:15%" class="red">保温箱编号</td>
<td style="width:15%;text-align: left;"><input id="" name="" class="mini-textbox warmidclass" />
</td>
</tr>
<tr>
<td style="width:15%" class="red">温度计编号</td>
<td style="width:15%;text-align: left;"><input id="" name="" class="mini-textbox wendujidclass" />
</td>
<td style="width:15%" class="red">温度(℃)</td>
<td style="width:15%;text-align: left;">
<div class="mini-autocomplete temperatureclass1" style="width:60px;" popupWidth="200" textField="alarmBgnHumidity" valueField="alarmBgnTemperature" required="true" name="alarmBgnTemperature" id="alarmBgnTemperature" loadingText="查询中..." popupEmptyText="无查询结果" url="${rc.contextPath}/addAlarmHewb/findMometer">
<div property="columns">
<div header="温度下限" field="alarmBgnTemperature"></div>
<div header="温度上限" field="alarmEndTemperature"></div>
</div>
</div>
---
<input id="alarmEndTemperature" name="alarmEndTemperature" class="mini-textbox temperatureclass2" style="width: 60px;" />
</td>
<td style="width:15%;" class="red">湿度(%)</td>
<td style="width:15%;text-align: left;">
<div class="mini-autocomplete limitclass1" style="width:60px;" popupWidth="200" textField="alarmBgnHumidity" valueField="alarmBgnHumidity" required="true" name="alarmBgnHumidity" id="alarmBgnHumidity" loadingText="查询中..." popupEmptyText="无查询结果" url="${rc.contextPath}/addAlarmHewb/findMometer">
<div property="columns">
<div header="湿度下限" field="alarmBgnHumidity"></div>
<div header="湿度上限" field="alarmEndHumidity"></div>
</div>
</div>
---
<input id="alarmEndHumidity" name="alarmEndHumidity" class="mini-textbox limitclass2" style="width: 60px;" />
</td>
</tr>
</table>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>
</form>
</body>
<script type="text/javascript">
var sonidcomboxs = [{
id: 1,
text: '子单1'
}, {
id: 2,
text: '子单2'
}, {
id: 3,
text: '子单3'
}];
mini.parse();
$("#content").hide();
$(function() {
// $("#tem").hide();
})
var orderList = [];
function addson() { //新增
$("#content").show();
debugger
// $('#mainCount').append('<input class="mini-autocomplete" id="test" style="width:150px;" textField="text" valueField="id" url="" value="cn" showNullItem="true" allowInput="true" onbeforeload="onload" />')
if(orderList.indexOf(id) < 0) {
$("#mainCount").append($("#tem").html());
}
orderList.push(id);
console.log((orderList))
}
var hewb_no = ""; //子单编号
var goods_name = ""; // 物品名称
var warmidclass = ""; //保温箱编号
var wendujidclass = ""; //温度计编号
var alarm_bgn_temperature = ""; //温度1
var alarm_end_temperature = ""; //温度2
var alarm_bgn_humidity = ""; //湿度
var alarm_end_humidity = ""; //湿度2
// console.log("aaa", $(".allcontent").eq(0).find(".editForm1").find(".powerclass").find("input").val())
function btnsave() { //保存
var listdata = [];
for(var i = 0; i < orderList.length; i++) {
hewb_no = $(".allcontent").eq(i).find(".editForm").find(".hewb_no").find("input").val();
goods_name = $(".allcontent").eq(i).find(".editForm").find(".goods_name").find("input").val();
warmidclass = $(".allcontent").eq(i).find(".editForm").find(".warmidclass").find("input").val();
wendujidclass = $(".allcontent").eq(i).find(".editForm").find(".wendujidclass").find("input").val();
alarm_bgn_temperature = $(".allcontent").eq(i).find(".editForm").find(".temperatureclass1").find("input").val();
alarm_end_temperature = $(".allcontent").eq(i).find(".editForm").find(".temperatureclass2").find("input").val();
alarm_bgn_humidity = $(".allcontent").eq(i).find(".editForm").find(".limitclass1").find("input").val();
alarm_end_humidity = $(".allcontent").eq(i).find(".editForm").find(".limitclass2").find("input").val();
//console.log("loginname", $(".allcontent").eq(i).find(".editForm").find(".sonidclass").find("input").val());
listdata.push({
hewb_no: hewb_no,
goods_name: goods_name,
warmidclass: warmidclass,
wendujidclass: wendujidclass,
alarm_bgn_temperature: alarm_bgn_temperature,
alarm_end_temperature: alarm_end_temperature,
alarm_bgn_humidity: alarm_bgn_humidity,
alarm_end_humidity: alarm_end_humidity,
});
}
console.log("listdata", listdata);
listdata = [];
}
function btnclose() { //取消
console.log("--", orderList.length) //2
$("#mainCount").find(".count").eq(orderList.length - 1).remove();
orderList.pop();
if(orderList.length == 0) {
$("#content").hide();
}
console.log(orderList)
}
function reload(e){
console.log(e)
}
</script>
<script src="${rc.contextPath}/resources/static/js/xopt/SonWaybillBind.js" type="text/javascript" charset="utf-8"></script>
</html>
作者:
felt
时间:
2019-10-21 13:13:19
本帖最后由 felt 于 2019-10-21 13:17 编辑
都是问题 发表于 2019-10-21 12:39
子单绑定
1 通过添加字符串方式添加的控件,填加完成之后请调用mini.parse()来确保已经解析成miniui控件
2 请使用mini.get(id).getValue()来获取控件值
3 autocomolete需要后台根据输入的参数进行查询,你这里后台有进行处理吗?
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2