init: function (element) {
this.$table1wrap = $('<div/>').attr('id', 'table1wrapper');
this.$table2wrap = $('<div/>').attr('id', 'table2wrapper');
this.$el.append([this.$table1wrap, this.$table2wrap]);
create: function (machine, process) {
$tableHeading = $('<tr/>'),
$table = $('<table/>').attr('id', 'mainTable');
this.$table1wrap.html($table.append($('<thead/>').html($tableHeading)));
this.processes = this.createCols(process);
this.machines = this.createRows(machine);
$(this.machines).each(function (index, row) {
$(self.processes).each(function (i, col) {
var letter = String.fromCharCode(97 + i).toUpperCase();
if (i == 0) $tableHeading.append($('<th/>').text('~'));
$tableHeading.append($('<th/>').text(letter));
if (i == 0) $curRow.append($('<td/>')
$curRow.append($(col).attr('contentEditable', 'true'));
$table.append($curRow.clone());
createCols: function (cols) {
var rCols = _.range(cols).map(function (num, index) {
return $('<td/>').text(0);
createRows: function (rows) {
var rRows = _.range(rows).map(function (num, index) {
var $newTable = $(sel).clone().attr('id', 'copy');
var $sortedBody = $($newTable)
.html(this.calcRank($newTable));
$(this.$table2wrap).html($($newTable, 'tbody').append($sortedBody));
calcRank: function (newTable) {
newTable.find('tr').each(function (index, item) {
$col = $(item).children();
$col.each(function (i, cell) {
if (i > 0) sum += parseInt($(cell).text());
$(item).attr('data-rank', sum);
return tinysort($(newTable).find('tbody>tr'), {
this.$table1wrap.empty();
this.$table2wrap.empty();
$('#btnCreate').click(function () {
var proc = $('#process').val(),
machine = $('#machine').val();
ROC.create(machine, proc);
$('#btnCreate2').click(function () {
$('#btnRst').click(function () {