no id=mxui.widget.ListView on some listviews

0
I have a strange issue where , in some cases, the id=mxuid.widget.Listview is missing when i inspect the html. This is a problem because the autoloadmore widget relies on this id to work.   I cannot figure out why this is happening. There are other listviews that work just fine but I am out of ideas where to look to find an explanation.  Anyone ?     where you would expect
asked
1 answers
0

Hey Jarno,

Did you try deleting the listview and just adding it freshly from the Toolbox menu? I have found this can sometimes resolve these issues. 

Alternatively, if you really cannot get the widget to work, you could manually reset the id by using a javascript call on the page. Make sure you add a unique class to your list first, e.g. “target-list-to-fix”. Then the JavaScript code could look something like this.

//get the listview
let targetListview = document.querySelector('.target-list-to-fix');

//get the items in it
let listItems = targetListview.querySelectorAll('li');

//iterate over the items, and use an index (i)
listItems.forEach(function (item, i) {

    //set the right id, using the index
    item.setAttribute('id', 'mx-name-index-'+i);
});

Hope this will help.

Best regards,

Wouter

answered