我必须在列拖放时在html选择中绑定List。以下是获取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
});
}
//以下函数用于拖放。
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
;目前,select不与list<strings>
绑定。
答案 0 :(得分:0)
在脚本中执行以下更改。
替换
var draggable = ui.draggable;
带
var draggable = ui.draggable({helper:'clone'});