fix: async table js util now knows current random css prefix
This commit is contained in:
parent
cfb09b089a
commit
cc90faf732
@ -35,6 +35,7 @@
|
||||
var pageLinks = [];
|
||||
var pagesizeForm;
|
||||
var scrollTable;
|
||||
var cssIdPrefix = '';
|
||||
|
||||
var tableFilterInputs = {
|
||||
search: [],
|
||||
@ -100,7 +101,7 @@
|
||||
}
|
||||
|
||||
function setupPagination() {
|
||||
var pagination = element.querySelector('#' + asyncTableId + '-pagination');
|
||||
var pagination = element.querySelector('#' + cssIdPrefix + asyncTableId + '-pagination');
|
||||
if (pagination) {
|
||||
pageLinks = Array.from(pagination.querySelectorAll('.page-link')).map(function(link) {
|
||||
return { element: link };
|
||||
@ -126,7 +127,7 @@
|
||||
|
||||
function setupPageSizeSelect() {
|
||||
// pagesize form
|
||||
pagesizeForm = element.querySelector('#' + asyncTableId + '-pagesize-form');
|
||||
pagesizeForm = element.querySelector('#' + cssIdPrefix + asyncTableId + '-pagesize-form');
|
||||
|
||||
if (pagesizeForm) {
|
||||
var pagesizeSelect = pagesizeForm.querySelector('[name=' + asyncTableId + '-pagesize]');
|
||||
@ -206,9 +207,12 @@
|
||||
// focus previously focused input
|
||||
if (focusedInput && focusedInput.selectionStart !== null) {
|
||||
var selectionStart = focusedInput.selectionStart;
|
||||
var focusId = focusedInput.id;
|
||||
// remove the following part of the id to get rid of the random
|
||||
// (yet somewhat structured) prefix we got from nudging.
|
||||
var matcher = /r\d*?__/;
|
||||
var focusId = focusedInput.id.replace(matcher, '');
|
||||
callback = function(wrapper) {
|
||||
var toBeFocused = wrapper.querySelector('#' + focusId);
|
||||
var toBeFocused = wrapper.querySelector('#' + cssIdPrefix + focusId);
|
||||
if (toBeFocused) {
|
||||
toBeFocused.focus();
|
||||
toBeFocused.selectionStart = selectionStart;
|
||||
@ -352,7 +356,8 @@
|
||||
function updateWrapperContents(response) {
|
||||
var newPage = document.createElement('div');
|
||||
newPage.appendChild(response.element);
|
||||
var newWrapperContents = newPage.querySelector('#' + element.id);
|
||||
cssIdPrefix = response.idPrefix;
|
||||
var newWrapperContents = newPage.querySelector('#' + cssIdPrefix + element.id);
|
||||
element.innerHTML = newWrapperContents.innerHTML;
|
||||
|
||||
if (UtilRegistry) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user