如何显示列表<字符串>在 html 选择控件中字符串>
我必须在拖放列时绑定 html 选择中的列表。以下是我获取 list
的函数
var oper;
function FunctionScript() {
$.ajax({
type: "POST",
url: "Webtop.aspx/FunctionDropdown",
data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$("#ddOperators").empty();
for (var i = 0, l = msg.d.length; i < l; i++) {
$("#ddOperators").append("<option>" + msg.d[i] + "</option>");
oper = msg.d;
alert("Check Dropdown");
}
alert('Check Operator DropDown' + msg.d.length);
},
error: DisplayError
});
}
//以下函数用于拖放。
function handleDropEvent(event, ui) {
var draggable = ui.draggable;
var uid = removeSpaces(draggable.attr('text'));
FunctionScript();
var colName = draggable.attr('title');
$('#selectedColumns > tbody:last').append('<tr id="' + uid + '"><td></td>
<td><input type="checkbox" id="chk" checked="checked" /></td><td><label>' + colName + '</label></td><td><input type="text" /></td><td><a href="#">Delete</a></td>
<td><select title="select table" id="ddOperators"/></td><td><input type="text" /></td>
<td><div><input type="text" value="" size="20" name="txtForeColor"/><a id="pick2" name="pick2" href="#">Select Color</a></div></td><td></td></tr>');
$("#selectedColumns").tableDnD({ onDragClass: "DragClass" });
}
select的id是ddOperators;目前,选择不与list
绑定。
I have to bind the List in html select upon drag drop of the columns. The following is my function to get list<string>
var oper;
function FunctionScript() {
$.ajax({
type: "POST",
url: "Webtop.aspx/FunctionDropdown",
data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$("#ddOperators").empty();
for (var i = 0, l = msg.d.length; i < l; i++) {
$("#ddOperators").append("<option>" + msg.d[i] + "</option>");
oper = msg.d;
alert("Check Dropdown");
}
alert('Check Operator DropDown' + msg.d.length);
},
error: DisplayError
});
}
//The following function is used for dragdrop.
function handleDropEvent(event, ui) {
var draggable = ui.draggable;
var uid = removeSpaces(draggable.attr('text'));
FunctionScript();
var colName = draggable.attr('title');
$('#selectedColumns > tbody:last').append('<tr id="' + uid + '"><td></td>
<td><input type="checkbox" id="chk" checked="checked" /></td><td><label>' + colName + '</label></td><td><input type="text" /></td><td><a href="#">Delete</a></td>
<td><select title="select table" id="ddOperators"/></td><td><input type="text" /></td>
<td><div><input type="text" value="" size="20" name="txtForeColor"/><a id="pick2" name="pick2" href="#">Select Color</a></div></td><td></td></tr>');
$("#selectedColumns").tableDnD({ onDragClass: "DragClass" });
}
The id of select is ddOperators
; Currently the select does not bind with the list<strings>
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的脚本中进行以下更改。
替换
为
Do the following changes in your script.
replace
with