|
|
@ -14,6 +14,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
, "jquery-ui"
|
|
|
|
, "jquery-ui"
|
|
|
|
, "jquery-event-drag"
|
|
|
|
, "jquery-event-drag"
|
|
|
|
|
|
|
|
, "jquery-clone-styles"
|
|
|
|
|
|
|
|
|
|
|
|
, "datatables"
|
|
|
|
, "datatables"
|
|
|
|
, "dt-scroller"
|
|
|
|
, "dt-scroller"
|
|
|
@ -293,21 +294,22 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
List.__super__.initialize.apply(this, arguments);
|
|
|
|
List.__super__.initialize.apply(this, arguments);
|
|
|
|
|
|
|
|
|
|
|
|
//this.$el.find("table:first").html("<tr><td><h1>" + this.type + "</h1></td></tr>");
|
|
|
|
if (that.options.type === "playlist" && that.options.collection) {
|
|
|
|
|
|
|
|
|
|
|
|
this.$el.find("tr").draggable();
|
|
|
|
|
|
|
|
this.$el.find("td").draggable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (that.options.type === "playlist") {
|
|
|
|
|
|
|
|
that.options.collection.fetch();
|
|
|
|
that.options.collection.fetch();
|
|
|
|
|
|
|
|
that.options.collection.on("add", function __fnPlaylistAddRow(model) {
|
|
|
|
|
|
|
|
if (that.dataTable) {
|
|
|
|
|
|
|
|
that.dataTable.fnAddData(model.toJSON(), that.$el.is(":visible"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Sometimes the parent element's size is 0 and resizing fails.
|
|
|
|
, resize: function () {
|
|
|
|
, resize: function () {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
, parentEl = that.options.parentEl//that.$el.parent()
|
|
|
|
, parentEl = that.options.parentEl || that.$el.parent()
|
|
|
|
, parentWidth = parentEl.innerWidth()
|
|
|
|
, parentWidth = parentEl.innerWidth()
|
|
|
|
, parentHeight = parentEl.innerHeight()
|
|
|
|
, parentHeight = parentEl.innerHeight()
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -325,9 +327,7 @@ console.log(parentWidth, that.$el.innerWidth(), parentHeight, that.$el, parentEl
|
|
|
|
, render: function () {
|
|
|
|
, render: function () {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
, initialHeight = that.$el.innerHeight() - 20
|
|
|
|
, initialHeight = that.$el.innerHeight() - 20
|
|
|
|
;
|
|
|
|
, dataTableOpts = {
|
|
|
|
|
|
|
|
|
|
|
|
this.dataTable = this.$el.find("table:first").dataTable({
|
|
|
|
|
|
|
|
sScrollY: initialHeight + "px"
|
|
|
|
sScrollY: initialHeight + "px"
|
|
|
|
, sDom: "RTrtS"
|
|
|
|
, sDom: "RTrtS"
|
|
|
|
, oColReorder: {
|
|
|
|
, oColReorder: {
|
|
|
@ -346,9 +346,6 @@ console.log(parentWidth, that.$el.innerWidth(), parentHeight, that.$el, parentEl
|
|
|
|
//, bProcessing: true
|
|
|
|
//, bProcessing: true
|
|
|
|
//, bServerSide: true
|
|
|
|
//, bServerSide: true
|
|
|
|
|
|
|
|
|
|
|
|
// Default sorting order
|
|
|
|
|
|
|
|
, aaSorting: [[2, "asc"], [6, "asc"], [3, "asc"], [5, "asc"], [4, "asc"]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, aaData: that.collection.toJSON()
|
|
|
|
, aaData: that.collection.toJSON()
|
|
|
|
|
|
|
|
|
|
|
|
, aoColumns: that.tableSchema
|
|
|
|
, aoColumns: that.tableSchema
|
|
|
@ -382,6 +379,8 @@ console.log(parentWidth, that.$el.innerWidth(), parentHeight, that.$el, parentEl
|
|
|
|
$(this)
|
|
|
|
$(this)
|
|
|
|
.closest("tr")
|
|
|
|
.closest("tr")
|
|
|
|
.clone()
|
|
|
|
.clone()
|
|
|
|
|
|
|
|
.css($(this).getStyleObject())
|
|
|
|
|
|
|
|
.addClass("selected")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.parent()
|
|
|
|
.parent()
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -403,8 +402,11 @@ console.log(parentWidth, that.$el.innerWidth(), parentHeight, that.$el, parentEl
|
|
|
|
//var rowModel = that.collection.get(aData.id);
|
|
|
|
//var rowModel = that.collection.get(aData.id);
|
|
|
|
//view.rows.push(new DtRowView({id: aData.id, el: nRow, model: rowModel}));
|
|
|
|
//view.rows.push(new DtRowView({id: aData.id, el: nRow, model: rowModel}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
|
|
|
|
, fnServerData: function(sSource, aoData, fnCallback, settings) {
|
|
|
|
, fnServerData: function(sSource, aoData, fnCallback, settings) {
|
|
|
|
|
|
|
|
console.log(sSource, aoData, fnCallback, settings);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
// function used to populate the DataTable with the current
|
|
|
|
// function used to populate the DataTable with the current
|
|
|
|
// content of the collection
|
|
|
|
// content of the collection
|
|
|
|
var populateTable = function()
|
|
|
|
var populateTable = function()
|
|
|
@ -440,7 +442,25 @@ console.log(parentWidth, that.$el.innerWidth(), parentHeight, that.$el, parentEl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Default sorting order
|
|
|
|
|
|
|
|
if (that.options.type !== "playlist") {
|
|
|
|
|
|
|
|
dataTableOpts.aaSorting = [[2, "asc"], [6, "asc"], [3, "asc"], [5, "asc"], [4, "asc"]];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
var schemaLastItem = (that.tableSchema.length - 1);
|
|
|
|
|
|
|
|
dataTableOpts.aaSorting = [[schemaLastItem, "asc"]];
|
|
|
|
|
|
|
|
that.tableSchema[schemaLastItem].mData = "order";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < schemaLastItem; i++) {
|
|
|
|
|
|
|
|
that.tableSchema[i].bSortable = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataTableOpts.aoColumns = that.tableSchema;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.dataTable = this.$el.find("table:first").dataTable(dataTableOpts);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|