I just started using jQuery and am trying to learn as I go, but I have hit a road block.
I am in the process of creating an order sorting application using jQuery inside MVC3 that uses droppable tabs with draggable orders. I have the basic frame work of it created, I am just having issues with creating new tabs.
I need the application to create a new tab for every driver that is put into the system. As it stands right now it creates the tab, but the tab doesn't have any functionality, it only looks like a separate tab, when in reality, all of the created "tabs" are on the same functional tab.
This is the code I have so far.
<script type="text/javascript">
$(function () {
$('#date').datepicker();
$("#sortable1, #sortable2").sortable().disableSelection();
var $tabs = $("#tabs").tabs().addClass("ui-tabs-vertical ui-helper-clearfix");
$("#tabs li").removeClass("ui-corner-top").addClass("ui-corner-right");
var $tab_items = $("ul:first li", $tabs).droppable({
accept: ".connectedSortable li",
hoverClass: "ui-state-hover",
drop: function (event, ui) {
var $item = $(this);
var $list = $($item.find("a").attr("href"))
.find(".connectedSortable");
ui.draggable.hide("slow", function () {
$(this).appendTo($list).show("slow");
});
}
});
});
</script>
</head>
<body style="cursor: auto;">
<div class="demo">
<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
<li class="ui-state-default ui-corner-top ui-droppable ui-tabs-selected ui-state-active">
<a href="#tabs-1">Unassigned</a></li>
@foreach (var item in Model.deliveryDrivers)
{
<li class="ui-state-default ui-corner-top ui-droppable">
<a href="#tabs-2">
@item.DriverName
<br />
Current Orders:
@item.SalesOrders.Count
</a></li>
}
Any help would be appreciated