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 () {
|
||||
var podcast = mod.podcastTableWidget.getSelectedRows()[0];
|
||||
mod.podcastEpisodeTableWidget.reload(podcast.id);
|
||||
mod.podcastTableWidget._clearSelection();
|
||||
mod.podcastTableWidget.clearSelection();
|
||||
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
|
||||
// in the left-hand pane.
|
||||
mod.podcastTableWidget.assignDblClickHandler(function () {
|
||||
var podcast = mod.podcastDataTable.fnGetData($(this).index());
|
||||
var podcast = mod.podcastDataTable.fnGetData(this);
|
||||
mod.podcastEpisodeTableWidget.reload(podcast.id);
|
||||
mod.podcastTableWidget._clearSelection();
|
||||
mod.podcastTableWidget.clearSelection();
|
||||
mod.setCurrentTable(mod.DataTableTypeEnum.PODCAST_EPISODES);
|
||||
});
|
||||
|
||||
|
@ -1494,6 +1494,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
},
|
||||
validateConstraints: function () {
|
||||
// TODO: change text + behaviour for playlists, smart blocks, etc.
|
||||
return checkSelectedEpisodeImportStatus.call(this, true);
|
||||
}
|
||||
},
|
||||
|
@ -1541,7 +1542,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
mod.podcastEpisodeDataTable = $datatables[mod.DataTableTypeEnum.PODCAST_EPISODES] = mod.podcastEpisodeTableWidget.getDatatable();
|
||||
mod.podcastEpisodeTableWidget.assignDblClickHandler(function () {
|
||||
var data = mod.podcastEpisodeDataTable.fnGetData($(this).index());
|
||||
var data = mod.podcastEpisodeDataTable.fnGetData(this);
|
||||
if (!$.isEmptyObject(data.file)) {
|
||||
mod.dblClickAdd(data.file, data.file.ftype);
|
||||
} else {
|
||||
|
|
|
@ -607,9 +607,9 @@ var AIRTIME = (function (AIRTIME) {
|
|||
var self = this;
|
||||
$(nRow).draggable({
|
||||
helper: function () {
|
||||
var $row = $(this);
|
||||
$row.data("aData", self._datatable.fnGetData($(nRow).index()).file);
|
||||
self.selectRow(this, self._datatable.fnGetData($row.index()), self.SELECTION_MODE.SINGLE, $row.index());
|
||||
var $row = $(this), data = self._datatable.fnGetData(nRow);
|
||||
$row.data("aData", data.file);
|
||||
self.selectRow(this, data, self.SELECTION_MODE.SINGLE, $row.index());
|
||||
var selected = self.getSelectedRows().length, container,
|
||||
width = self._$wrapperDOMNode.closest(".dataTables_wrapper").outerWidth(), message;
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
*/
|
||||
if (bItemSelection) {
|
||||
$(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 nRow = this;
|
||||
|
||||
|
@ -148,6 +148,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
e.stopPropagation();
|
||||
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
|
||||
|
@ -254,7 +259,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
return outerDiv;
|
||||
};
|
||||
|
||||
Table.prototype._clearSelection = function() {
|
||||
Table.prototype.clearSelection = function() {
|
||||
this._selectedRows = [];
|
||||
//self._selectedRowVisualIdxMap = [];
|
||||
this._selectedRowVisualIdxMin = self.HUGE_INT;
|
||||
|
@ -283,8 +288,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
//Regular single left-click mode
|
||||
if (selectionMode == self.SELECTION_MODE.SINGLE) {
|
||||
|
||||
self._clearSelection();
|
||||
self.clearSelection();
|
||||
|
||||
self._selectedRows.push(aData);
|
||||
self._selectedRowVisualIdxMin = iVisualRowIdx;
|
||||
|
|
Loading…
Reference in New Issue