Permalink
Browse files

no time for good solution, ui logic in controller

  • Loading branch information...
petermorlion committed Jul 2, 2014
1 parent 7c3df93 commit ff8bf2fe772d751aa515c1dd6a34b9aa3dafab15
@@ -40,7 +40,6 @@ public static void RegisterBundles(BundleCollection bundles)
"~/Scripts/app/main/points.js",
"~/Scripts/app/statistics/statistics.js",
"~/Scripts/app/overview/overview.js",
"~/Scripts/app/tableheader.js",
"~/Scripts/highcharts/highcharts.js",
"~/Scripts/toastr.js"));

BIN -90 Bytes (100%) KotProno2/Scripts/_references.js
Binary file not shown.
@@ -16,9 +16,52 @@
}).success(function (data, status, headers, config) {
vm.overview = data;
vm.isLoading = false;
initializeTable();
}).error(function (data, status, headers, config) {
toastr.error('Er is helaas een fout gebeurd.');
});

// TODO: UI logic in controller...
var initializeTable = function () {
var table = $('table.table-fixed-header');
if (table.length === 0) {
console.log('nothing found!')
return;
}

var tableHeader = table.find('thead');
var clonedHeader = tableHeader.clone(true);

var navbarHeight = $('.navbar').height();

var fixedTable = $('<table class="table"/>')
.insertBefore(table)
.css({ position: 'fixed', top: navbarHeight + 'px', 'background-color': '#fff', width: table.width() });

clonedHeader
.hide()
.appendTo(fixedTable);

var y = tableHeader.position().top - navbarHeight;

var handleScroll = function () {
if ($(window).scrollTop() > y) {
clonedHeader.show();
} else {
clonedHeader.hide();
}

var move = $(window).scrollLeft();
var origin = table.position().left;
fixedTable.css('left', origin - move);
};

handleScroll();

$(window).scroll(function () {
handleScroll();
});
};

}]);
})();

This file was deleted.

Oops, something went wrong.

0 comments on commit ff8bf2f

Please sign in to comment.