You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
3.5 KiB
94 lines
3.5 KiB
|
|
//setname:要移出数据的列表名称 getname:要移入数据的列表名称 savename:用與後台取值的隱藏欄位 savelst:選擇的列表
|
|
function fnListMove(setname, getname, savename, savelst) {
|
|
var size = $("#" + setname + " option").size();
|
|
var selsize = $("#" + setname + " option:selected").size();
|
|
if (size > 0 && selsize > 0) {
|
|
$.each($("#" + setname + " option:selected"), function (id, own) {
|
|
var text = $(own).text();
|
|
var tag = $(own).attr("value");
|
|
$("#" + getname).prepend("<option title=\"" + text + "\" value=\"" + tag + "\">" + text + "</option>");
|
|
$(own).remove();
|
|
//$("#" + setname + "").children("option:first").attr("selected", true);
|
|
|
|
//赋值到hidvalue中
|
|
var strvalue = "";
|
|
$.each($("#" + savelst + " option"), function (id, own) {
|
|
strvalue += $(own).val();
|
|
if (id != $("#" + savelst + " option").size() - 1) {
|
|
strvalue += "|";
|
|
}
|
|
});
|
|
$("#" + savename).val(strvalue);
|
|
});
|
|
}
|
|
}
|
|
|
|
function fnListMoveDel(setname, getname, savename, savelst) {
|
|
var size = $("#" + setname + " option").size();
|
|
var selsize = $("#" + setname + " option:selected").size();
|
|
if (size > 0 && selsize > 0) {
|
|
$.each($("#" + setname + " option:selected"), function (id, own) {
|
|
var text = $(own).text();
|
|
var tag = $(own).attr("value");
|
|
var UnitPrice = $(own).attr("UnitPrice");
|
|
//$("#" + getname).prepend("<option title=\"" + text + "\" value=\"" + tag + "\" UnitPrice=\"" + UnitPrice + "\">" + text + "</option>");
|
|
$(own).remove();
|
|
$("#" + setname + "").children("option:first").attr("selected", true);
|
|
});
|
|
}
|
|
|
|
//重新排序
|
|
// $.each($("#" + getname + " option"), function (id, own) {
|
|
// orderrole(getname);
|
|
// });
|
|
}
|
|
|
|
//按首字母排序角色列表
|
|
function orderrole(listname) {
|
|
var size = $("#" + listname + " option").size();
|
|
var one = $("#" + listname + " option:first-child");
|
|
if (size > 0) {
|
|
var text = $(one).text();
|
|
var tag = parseInt($(one).attr("tag"));
|
|
//循环列表中第一项值下所有元素
|
|
$.each($(one).nextAll(), function (id, own) {
|
|
var nextag = parseInt($(own).attr("tag"));
|
|
if (tag > nextag) {
|
|
$(one).remove();
|
|
$(own).after("<option tag=\"" + tag + "\">" + text + "</option>");
|
|
one = $(own).next();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function ListBox_Order(action, listId, savename) {
|
|
var size = $("#" + listId + " option").size();
|
|
var selsize = $("#" + listId + " option:selected").size();
|
|
|
|
if (size > 0 && selsize > 0) {
|
|
$("#" + listId + " option:selected").each(function (index, item) {
|
|
if (action == "up") {
|
|
$(item).prev().insertAfter($(item));
|
|
return false;
|
|
}
|
|
else if (action == "down")//down时选中多个连靠则操作没效果
|
|
{
|
|
$(item).next().insertBefore($(item));
|
|
return false;
|
|
}
|
|
})
|
|
}
|
|
|
|
var strvalue = "";
|
|
$.each($("#" + listId + " option"), function (id, own) {
|
|
strvalue += $(own).val();
|
|
if (id != $("#" + listId + " option").size() - 1) {
|
|
strvalue += "|";
|
|
}
|
|
});
|
|
$("#" + savename).val(strvalue);
|
|
return false;
|
|
}
|