Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/example issues fixes #772

Merged
merged 2 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions controls/slick.pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
function constructPagerUI() {
// the container might be a string, a jQuery object or a native element
const container = getContainerElement(selectorOrElm);
if (!container || (container.jquery && !container[0])) return;

const navElm = document.createElement('span');
navElm.className = 'slick-pager-nav';
Expand Down Expand Up @@ -195,6 +196,7 @@
}

function updatePager(pagingInfo) {
if (!container || (container.jquery && !container[0])) return;
let state = getNavState();

// remove disabled class on all icons
Expand Down
2 changes: 1 addition & 1 deletion examples/example-grid-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ <h2>View Source:</h2>
};

// show 1st column with font-awesome hashtag icon
var columns = [{ id: 'id', field: 'id', name: '<i class="fa fa-hashtag"></i>', width: 40, excludeFromGridMenu: true }];
var columns = [{ id: 'id', field: 'id', name: '<i class="fa fa-info"></i>', width: 40, excludeFromGridMenu: true }];
var columnFilters = {};
var sortcol = "id";
var sortdir = 1;
Expand Down
3 changes: 2 additions & 1 deletion examples/example10-async-post-render.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ <h2>View Source:</h2>

<script src="../lib/firebugx.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<!-- nb: sparkline 2.x will cause a memory leak in the current architecture, so we use sparkline 1.x and jquery-migrate -->
<script src="../lib/jquery.sparkline.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs/Sortable.min.js"></script>
Expand Down
3 changes: 2 additions & 1 deletion slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2977,7 +2977,8 @@ if (typeof Slick === "undefined") {
_headers.forEach(function (header) {
for (let i = 0; i < header.children.length; i++, columnIndex++) {
const h = header.children[i];
const width = columns[columnIndex].width - headerColumnWidthDiff;
const col = columns[columnIndex] || {};
const width = (col.width || 0) - headerColumnWidthDiff;
if (utils.width(h) !== width) {
utils.width(h, width);
}
Expand Down
12 changes: 6 additions & 6 deletions slick.interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
};

if (containerElement) {
containerElement.addEventListener('mousedown', userPressed);
containerElement.addEventListener('mousedown', userPressed, Slick.Utils.enablePassiveWhenSupported());
containerElement.addEventListener('touchstart', userPressed, Slick.Utils.enablePassiveWhenSupported());
}

Expand All @@ -51,7 +51,7 @@

function destroy() {
if (containerElement) {
containerElement.removeEventListener('mousedown', userPressed);
containerElement.removeEventListener('mousedown', userPressed, Slick.Utils.enablePassiveWhenSupported());
containerElement.removeEventListener('touchstart', userPressed, Slick.Utils.enablePassiveWhenSupported());
}
}
Expand Down Expand Up @@ -130,13 +130,13 @@
let { element, onMouseWheel } = options;

function destroy() {
element.removeEventListener('wheel', wheelHandler, Slick.Utils.enablePassiveWhenSupported());
element.removeEventListener('mousewheel', wheelHandler, Slick.Utils.enablePassiveWhenSupported());
element.removeEventListener('wheel', wheelHandler);
element.removeEventListener('mousewheel', wheelHandler);
}

function init() {
element.addEventListener('wheel', wheelHandler, Slick.Utils.enablePassiveWhenSupported());
element.addEventListener('mousewheel', wheelHandler, Slick.Utils.enablePassiveWhenSupported());
element.addEventListener('wheel', wheelHandler);
element.addEventListener('mousewheel', wheelHandler);
}

// copy over the same event handler code used in jquery.mousewheel
Expand Down