unable to select whole column of DataTable9.1
hi all,
here I am using tree view and Data table 9.1. with drag and drop functionality;Once i drag a node from tree view to html table it has to be column ;it is working fine;In same way when i drag a column from data table and drop on to tree view column should be deleted;I done some code;here i am attaching ;Currently dragging is possible for hard coded data..i already given 2-3 columns ;for those columns i can drag and drop total bunch;but when i am dragging newly added column Only column header is coming out of table;its not coming with column and related rows ;If am i need to add any pulg-ins please guide me how to do? or give the solution..suggest me ...
<style type="text/css" title="currentStyle">
@import "../DataTabels/demo_table.css";
</style>
<script src="DataTabels/jquery.js" type="text/javascript"></script>
<script src="DataTabels/jquery.dataTables.js" type="text/javascript"></script>
<script type="text/javascript" src="DataTabels/ColReorder.js"></script>
<script src="DataTabels/DragandDrop.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript">
debugger;
$(document).ready(function () {
$(".treeNode").draggable({ helper: 'clone' });
$("#droppable").droppable({
drop: function (event, ui) {
var columnName = $(ui.draggable).text();
var mytable = $("#sampleTable"),
iter = 0;
mytable.find('tr').each(function () {
var trow = $(this);
if (trow.index() === 0) {
trow.append('<th >' + columnName + '</th>');
}
else if (trow.index() >= 1) {
trow.append('<td> Mano </td>');
}
iter += 1;
});
$("#sampleTable").dataTable({
"sDom": 'Rlfrtip',
"bSort": true
});
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="TreeviewDiv">
<asp:TreeView ID="TreeView1" runat="server" ImageSet="BulletedList3">
<Nodes>
<asp:TreeNode Text="AccountGeneral" Value="AccountGeneral">
<asp:TreeNode Text="AccountOwner" Value="AccountOwner"></asp:TreeNode>
<asp:TreeNode Text="CreatedBy" Value="CreatedBy"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
<NodeStyle CssClass="treeNode" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black"
HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
<ParentNodeStyle Font-Bold="True" ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px" />
</asp:TreeView>
</div>
<div>
</div>
<br />
<div id="droppable">
<table id="sampleTable" class="draggable">
<thead> <tr> <th> AccountType </th><th> AccountName</th> </tr></thead><tbody><tr>
<td>New</td><td>Name1</td> </tr> <tr> <td>Lead </td> <td>Name2 </td></tr>
<tr><td> test </td> <td> Name3 </td></tr>
</tbody>
</table>
</div>
</form>
Thanks in advance,