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 pageLinks = [];
|
||||||
var pagesizeForm;
|
var pagesizeForm;
|
||||||
var scrollTable;
|
var scrollTable;
|
||||||
|
var cssIdPrefix = '';
|
||||||
|
|
||||||
var tableFilterInputs = {
|
var tableFilterInputs = {
|
||||||
search: [],
|
search: [],
|
||||||
@ -100,7 +101,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupPagination() {
|
function setupPagination() {
|
||||||
var pagination = element.querySelector('#' + asyncTableId + '-pagination');
|
var pagination = element.querySelector('#' + cssIdPrefix + asyncTableId + '-pagination');
|
||||||
if (pagination) {
|
if (pagination) {
|
||||||
pageLinks = Array.from(pagination.querySelectorAll('.page-link')).map(function(link) {
|
pageLinks = Array.from(pagination.querySelectorAll('.page-link')).map(function(link) {
|
||||||
return { element: link };
|
return { element: link };
|
||||||
@ -126,7 +127,7 @@
|
|||||||
|
|
||||||
function setupPageSizeSelect() {
|
function setupPageSizeSelect() {
|
||||||
// pagesize form
|
// pagesize form
|
||||||
pagesizeForm = element.querySelector('#' + asyncTableId + '-pagesize-form');
|
pagesizeForm = element.querySelector('#' + cssIdPrefix + asyncTableId + '-pagesize-form');
|
||||||
|
|
||||||
if (pagesizeForm) {
|
if (pagesizeForm) {
|
||||||
var pagesizeSelect = pagesizeForm.querySelector('[name=' + asyncTableId + '-pagesize]');
|
var pagesizeSelect = pagesizeForm.querySelector('[name=' + asyncTableId + '-pagesize]');
|
||||||
@ -206,9 +207,12 @@
|
|||||||
// focus previously focused input
|
// focus previously focused input
|
||||||
if (focusedInput && focusedInput.selectionStart !== null) {
|
if (focusedInput && focusedInput.selectionStart !== null) {
|
||||||
var selectionStart = focusedInput.selectionStart;
|
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) {
|
callback = function(wrapper) {
|
||||||
var toBeFocused = wrapper.querySelector('#' + focusId);
|
var toBeFocused = wrapper.querySelector('#' + cssIdPrefix + focusId);
|
||||||
if (toBeFocused) {
|
if (toBeFocused) {
|
||||||
toBeFocused.focus();
|
toBeFocused.focus();
|
||||||
toBeFocused.selectionStart = selectionStart;
|
toBeFocused.selectionStart = selectionStart;
|
||||||
@ -352,7 +356,8 @@
|
|||||||
function updateWrapperContents(response) {
|
function updateWrapperContents(response) {
|
||||||
var newPage = document.createElement('div');
|
var newPage = document.createElement('div');
|
||||||
newPage.appendChild(response.element);
|
newPage.appendChild(response.element);
|
||||||
var newWrapperContents = newPage.querySelector('#' + element.id);
|
cssIdPrefix = response.idPrefix;
|
||||||
|
var newWrapperContents = newPage.querySelector('#' + cssIdPrefix + element.id);
|
||||||
element.innerHTML = newWrapperContents.innerHTML;
|
element.innerHTML = newWrapperContents.innerHTML;
|
||||||
|
|
||||||
if (UtilRegistry) {
|
if (UtilRegistry) {
|
||||||
|
|||||||
Reference in New Issue
Block a user