Fix small bugs in table.js
This commit is contained in:
parent
48f09c44ca
commit
1bc0f9e54b
|
@ -1338,7 +1338,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
click: function () {
|
click: function () {
|
||||||
var podcast = mod.podcastTableWidget.getSelectedRows()[0];
|
var podcast = mod.podcastTableWidget.getSelectedRows()[0];
|
||||||
mod.podcastEpisodeTableWidget.reload(podcast.id);
|
mod.podcastEpisodeTableWidget.reload(podcast.id);
|
||||||
mod.podcastTableWidget._clearSelection();
|
mod.podcastTableWidget.clearSelection();
|
||||||
mod.setCurrentTable(mod.DataTableTypeEnum.PODCAST_EPISODES);
|
mod.setCurrentTable(mod.DataTableTypeEnum.PODCAST_EPISODES);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1376,9 +1376,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
// On double click, open a table showing the selected podcast's episodes
|
// On double click, open a table showing the selected podcast's episodes
|
||||||
// in the left-hand pane.
|
// in the left-hand pane.
|
||||||
mod.podcastTableWidget.assignDblClickHandler(function () {
|
mod.podcastTableWidget.assignDblClickHandler(function () {
|
||||||
var podcast = mod.podcastDataTable.fnGetData($(this).index());
|
var podcast = mod.podcastDataTable.fnGetData(this);
|
||||||
mod.podcastEpisodeTableWidget.reload(podcast.id);
|
mod.podcastEpisodeTableWidget.reload(podcast.id);
|
||||||
mod.podcastTableWidget._clearSelection();
|
mod.podcastTableWidget.clearSelection();
|
||||||
mod.setCurrentTable(mod.DataTableTypeEnum.PODCAST_EPISODES);
|
mod.setCurrentTable(mod.DataTableTypeEnum.PODCAST_EPISODES);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1494,6 +1494,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validateConstraints: function () {
|
validateConstraints: function () {
|
||||||
|
// TODO: change text + behaviour for playlists, smart blocks, etc.
|
||||||
return checkSelectedEpisodeImportStatus.call(this, true);
|
return checkSelectedEpisodeImportStatus.call(this, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1541,7 +1542,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
mod.podcastEpisodeDataTable = $datatables[mod.DataTableTypeEnum.PODCAST_EPISODES] = mod.podcastEpisodeTableWidget.getDatatable();
|
mod.podcastEpisodeDataTable = $datatables[mod.DataTableTypeEnum.PODCAST_EPISODES] = mod.podcastEpisodeTableWidget.getDatatable();
|
||||||
mod.podcastEpisodeTableWidget.assignDblClickHandler(function () {
|
mod.podcastEpisodeTableWidget.assignDblClickHandler(function () {
|
||||||
var data = mod.podcastEpisodeDataTable.fnGetData($(this).index());
|
var data = mod.podcastEpisodeDataTable.fnGetData(this);
|
||||||
if (!$.isEmptyObject(data.file)) {
|
if (!$.isEmptyObject(data.file)) {
|
||||||
mod.dblClickAdd(data.file, data.file.ftype);
|
mod.dblClickAdd(data.file, data.file.ftype);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -607,9 +607,9 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
var self = this;
|
var self = this;
|
||||||
$(nRow).draggable({
|
$(nRow).draggable({
|
||||||
helper: function () {
|
helper: function () {
|
||||||
var $row = $(this);
|
var $row = $(this), data = self._datatable.fnGetData(nRow);
|
||||||
$row.data("aData", self._datatable.fnGetData($(nRow).index()).file);
|
$row.data("aData", data.file);
|
||||||
self.selectRow(this, self._datatable.fnGetData($row.index()), self.SELECTION_MODE.SINGLE, $row.index());
|
self.selectRow(this, data, self.SELECTION_MODE.SINGLE, $row.index());
|
||||||
var selected = self.getSelectedRows().length, container,
|
var selected = self.getSelectedRows().length, container,
|
||||||
width = self._$wrapperDOMNode.closest(".dataTables_wrapper").outerWidth(), message;
|
width = self._$wrapperDOMNode.closest(".dataTables_wrapper").outerWidth(), message;
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
*/
|
*/
|
||||||
if (bItemSelection) {
|
if (bItemSelection) {
|
||||||
$(self._datatable, 'tbody tr').on('click contextmenu', self._SELECTORS.SELECTION_TABLE_ROW, function (e) {
|
$(self._datatable, 'tbody tr').on('click contextmenu', self._SELECTORS.SELECTION_TABLE_ROW, function (e) {
|
||||||
var aData = self._datatable.fnGetData($(this).index());
|
var aData = self._datatable.fnGetData(this);
|
||||||
var iDisplayIndex = $(this).index(); //The index of the row in the current page in the table.
|
var iDisplayIndex = $(this).index(); // The index of the row in the current page in the table.
|
||||||
var nRow = this;
|
var nRow = this;
|
||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -148,6 +148,11 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Clear selection when switching pages
|
||||||
|
$(self._datatable).on('page', function () {
|
||||||
|
self.clearSelection();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// On filter, display the number of total and filtered results in the search bar
|
// On filter, display the number of total and filtered results in the search bar
|
||||||
|
@ -254,7 +259,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
return outerDiv;
|
return outerDiv;
|
||||||
};
|
};
|
||||||
|
|
||||||
Table.prototype._clearSelection = function() {
|
Table.prototype.clearSelection = function() {
|
||||||
this._selectedRows = [];
|
this._selectedRows = [];
|
||||||
//self._selectedRowVisualIdxMap = [];
|
//self._selectedRowVisualIdxMap = [];
|
||||||
this._selectedRowVisualIdxMin = self.HUGE_INT;
|
this._selectedRowVisualIdxMin = self.HUGE_INT;
|
||||||
|
@ -283,8 +288,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
//Regular single left-click mode
|
//Regular single left-click mode
|
||||||
if (selectionMode == self.SELECTION_MODE.SINGLE) {
|
if (selectionMode == self.SELECTION_MODE.SINGLE) {
|
||||||
|
self.clearSelection();
|
||||||
self._clearSelection();
|
|
||||||
|
|
||||||
self._selectedRows.push(aData);
|
self._selectedRows.push(aData);
|
||||||
self._selectedRowVisualIdxMin = iVisualRowIdx;
|
self._selectedRowVisualIdxMin = iVisualRowIdx;
|
||||||
|
|
Loading…
Reference in New Issue