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

Update utils.js #6950

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions src/extensions/filter-control/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,12 @@ export function createControls (that, header) {
}
}
} else if (value && value.length > 0 && value.trim()) {
$selectControl.find('option[selected]').removeAttr('selected')
$selectControl.find(`option[value="${value}"]`).attr('selected', true)
for (let i = 0; i < currentTarget.options.length; i++) {
currentTarget.options[i].seleted = false
if (currentTarget.options[i].value === value) {
currentTarget.options[i].seleted = true
}
}
} else {
$selectControl.find('option[selected]').removeAttr('selected')
}
Expand Down
6 changes: 3 additions & 3 deletions src/extensions/sticky-header/bootstrap-table-sticky-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ $.BootstrapTable = class extends $.BootstrapTable {

const top = $(window).scrollTop()
// top anchor scroll position, minus header height
const start = this.$stickyBegin.offset().top - this.options.stickyHeaderOffsetY
const start = this.hasOwnProperty('$stickyBegin') ? this.$stickyBegin.offset().top - this.options.stickyHeaderOffsetY : 0
// bottom anchor scroll position, minus header height, minus sticky height
const end = this.$stickyEnd.offset().top - this.options.stickyHeaderOffsetY - this.$header.height()
const end = this.hasOwnProperty('$stickyEnd') ? this.$stickyEnd.offset().top - this.options.stickyHeaderOffsetY - this.$header.height() : 0

// show sticky when top anchor touches header, and when bottom anchor not exceeded
if (top > start && top <= end) {
Expand Down Expand Up @@ -144,7 +144,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
this.$stickyContainer.html(this.$stickyTable.append(this.$stickyHeader))
// match clone and source header positions when left-right scroll
this.matchPositionX()
} else {
} else if (this.$stickyContainer !== undefined) {
this.$stickyContainer.removeClass('fix-sticky').hide()
}
}
Expand Down