我正在创建带有排序的简单拖拽但是我遇到了问题,那就是在我对它们进行排序后拖放元素时,会发生元素的重复,第二个问题是满足它是不行的当我右键单击然后它可以正常工作但是当我左键单击它有时工作。我究竟做错了什么。我该怎么解决呢。
答案 0 :(得分:1)
您只需将CustomerID CustomerName Bank Amount
1 Martin BDO Php 55.00
1 Martin CBA Php 150.00
添加到SqlCommand sc = new SqlCommand();
sc.Connection = sqlConnection1;
sc.CommandText = "searchLogicName";
sc.CommandType = CommandType.StoredProcedure;
sc.Parameters.Add("@LogName", SqlDbType.VarChar, 50).Value = txtLogicName.Text;
if (sqlConnection1.State != ConnectionState.Open)
{
sqlConnection1.Open();
}
int existLogicName = Convert.ToInt32(sc.ExecuteScalar());
...
即可让accept: '#textTemplate',
接受droppable
#editorDesignView
<强>演示强>
#textTemplate
&#13;
$(function(){
$("#textTemplate").draggable({
helper: "clone"
});
$( "#editorDesignView" ).droppable({
accept: '#textTemplate', //add accept here
drop: function( event, ui ) {
var html = '<div id="" style="background: #eee; width: 80%; margin: 10px auto; padding: 10px;"><p contenteditable="true" style="padding: 5px;">Add your text here.</p></div>';
$(html).not('#editorDesignView div').appendTo(this).hide().slideDown();
var currentHtml = $("#editor").val();
$("#editor").val(currentHtml+html);
}
});
$('#editorDesignView').sortable();
});
&#13;
$(function(){
$("#textTemplate").draggable({
helper: "clone"
});
$( "#editorDesignView" ).droppable({
accept: '#textTemplate',
drop: function( event, ui ) {
var html = '<div id="" style="background: #eee; width: 80%; margin: 10px auto; padding: 10px;"><p contenteditable="true" style="padding: 5px;">Add your text here.</p></div>';
$(html).not('#editorDesignView div').appendTo(this).hide().slideDown();
var currentHtml = $("#editor").val();
$("#editor").val(currentHtml+html);
}
});
$('#editorDesignView').sortable();
});
&#13;