本篇文章是对Jquery中LigerUi的弹出编辑框的实现方法进行了分析介绍
需要的朋友可以参考下
一载入
复制代码 代码如下:
<link href="
/lib/ligerUI/skins/Aqua/css/ligerui
all
css" rel="stylesheet" type="text/css" />
<script src="
/lib/jquery/jquery
min
js" type="text/javascript"></script>
<script src="
/lib/ligerUI/js/ligerui
min
js" type="text/javascript"></script>
<script src="
/lib/ligerUI/js/plugins/ligerForm
js" type="text/javascript"></script>
<script src="
/lib/ligerUI/js/plugins/ligerGrid
js" type="text/javascript"></script>
<link href="
/lib/css/common
css" rel="stylesheet" type="text/css" />
<script src="
/lib/js/common
js" type="text/javascript"></script>
<script src="
/lib/js/LG
js" type="text/javascript"></script>
<script src="
/lib/jquery
validation/jquery
validate
min
js" type="text/javascript"></script>
<script src="
/lib/jquery
validation/jquery
metadata
js" type="text/javascript"></script>
<script src="
/lib/jquery
validation/messages_cn
js" type="text/javascript"></script>
<script src="
/lib/js/ligerui
expand
js" type="text/javascript"></script>
<script src="
/
/lib/ligerUI/js/plugins/ligerDateEditor
js" type="text/javascript"></script>
二Html
复制代码 代码如下:
<div id="Editdetail" style="display:none;"><form id="EditForm" method="post"></form> </div> <%
弹出编辑框DIV
%>
三在Add中添加事件
复制代码 代码如下:
//工具条事件
function toolbarBtnItemClick(item) {
switch (item
id) {
case "add":
addbill({}
true
添加记录
false);
break;
case "view":
var selected = grid
getSelected();
if (!selected) { LG
tip(
请选择行!
); return }
addbill(selected
false
查看记录
true);
break;
case "modify":
var selected = grid
getSelected();
if (!selected) { LG
tip(
请选择行!
); return }
addbill(selected
false
修改记录
false);
break;
case "delete":
jQuery
ligerDialog
confirm(
确定删除吗?
function (confirm) {
if (confirm)
f_delete();
});
break;
}
}
四在函数下面添加弹出框样式代码
复制代码 代码如下:
var detailWin = null
currentData = null
currentIsAddNew
currentIsView;
function addbill(data
isAddNew
t
isview) {
currentData = data;
currentIsAddNew = isAddNew;
currentIsView = isview;
if (detailWin) {
detailWin
set(
title
t);
detailWin
show();
}
else
{
// 放入弹出窗口样式内容
}
if (!isAddNew) {
// public int LrId { get; set; }
$("#ProtId
")
val(currentData
ProductName);
$("#ProId
")
val(currentData
ProductId);
$("#ForId
")
val(currentData
FormatName);
$("#Foad
")
val(currentData
FormatId);
$("#Ded
")
val(currentData
DegreeName);
$("#Degrd
")
val(currentData
DegreeId);
$("#Appl")
val(currentData
AppendBill);
$("#Bum")
val(currentData
BoxNum);
$("#Maate")
val(currentData
MadeDate);
$("#BottleNum")
val(currentData
BottleNum);
$("#Bumpany
")
val(currentData
BuyCompanyName);
$("#BuyCoy
")
val(currentData
BuyCompanyId);
$("#VayId
")
val(currentData
VarietyName);
$("#VarId
")
val(currentData
VarietyId);
$("#Handate")
val(currentData
HandDate);
$("#Fact
")
val(currentData
FactoryName);
$("#Fact
")
val(currentData
FactoryId);
$("#Froce
")
val(currentData
FromPlaceName);
$("#Froce
")
val(currentData
FromPlaceId);
}
}
五弹出窗口样式中的内容
复制代码 代码如下:
var mainform = $("#EditForm");
mainform
ligerForm({
inputWidth:
fields:
[
{ name: "ProId
"
type: "hidden" }
// 隐藏字段
为弹出选择编号保存值
{ display: "仓库"
name: "Daihao
"
newline: true
labelWidth:
width:
space:
type: "text"
validate: { required: true
digits: true} }
{ display: "商品名称"
name: "ProId"
comboboxName: "ProId
"
newline: false
labelWidth:
width:
space:
type: "select"
option: {} }
// 弹出选择框
{ display: "单位"
name: "DegreeId"
comboboxName: "DegreeId
"
newline: false
labelWidth:
width:
space:
type: "select"
options: { valueFieldID: "DegreeId
"
treeLeafOnly: false
tree: { url: "
/handle/se
ashx?ajaxaction=Getgree"
checkbox: false}} }
{ display: "生产日期"
name: "MadeDate
"
newline: true
labelWidth:
width:
space:
type: "date"
validate: { required: true} }
{ display: "备注"
name: "mark"
newline: false
labelWidth:
width:
space:
type: "text"
validate: { required: true
digits: true} }
]
toJSON: JSON
stringify
});
$
metadata
setType("attr"
"validate");
LG
validate(mainform
{ debug: true });
$("#HandDate")
val(currentdate);
$("#BoNum")
val("
");
$
ligerui
get("ProId
")
set(
onBeforeOpen
f_selectCoct)
$
ligerui
get("Faory
")
set(
onBeforeOpen
f_selectFary_
)
$
ligerui
get("Buyany
")
set(
onBeforeOpen
f_selectFary_
)
$
ligerui
get("Froce
")
set(
onBeforeOpen
f_selectFroace)
detailWin = $
ligerDialog
open({
target: $("#Editdetail")
width:
height:
top:
title: "添加保存修改窗口"
//
buttons: [
{ text:
保存
onclick: function () { save(); } }
{ text:
取消
onclick: function () { detailWin
hide(); } }
]
});
六保存事件