I have created a JavaScript function to take a url from a list item and turn it into an image.
This function works great on a list that doesn't have group by setup.
With this script the images will show up after I click the link the second time:
$(document).ready(function($) {
//Create the images on page load
createImages();
//check if the url hash changes and run createImages if it does
window.onhashchange = createImages;
var regExp = /ExpCollGroup(.*)\)/
$('.ms-commentexpand-iconouter').closest('a').each( function() {
var scr = regExp.exec($(this).attr('onclick'));
$(this).attr('onclick', scr[0] + '; ' + 'createImages();');
});
});
Here is the SharePoint function that is being called to load the groups data:
ExpCollGroup('58-2_', 'img_58-2_',event, false)
It looks like the group by doesn't load the data until you click on the link to show the data in that group. So with the script above the createImages function gets called but there is no data. If I click on it a 2nd, 3rd, etc... time the script works because the data has been loaded.
How can I run the createImages() function after the function to show the data has been loaded?