0

We don't want to show the webpart that is pulling data from a SPS2013 List, provided if no items are visible on the current view. As of now, the webpart is visible, but its blank when no data is visible on the associated SPS 2013 list.

1

You could add a script web part.

Add jQuery reference.

Use developer tools to get the ID of the web part on the page + the html container element for the list.

If the container has no children then hide the webpart.

For example:

jQuery(hideWebPartIfNoChildren);

function hideWebPartIfNoChildren() {

  var webPart = jQuery("#elementId"),
      children = jQuery("#containerId", webPart).children();

  if(children.length == 0) {
    webPart.hide();
  } else {
    webPart.show();
  }

}

You could call on an interval if you're lazy loading the CEWP or changing state between page loads (MDS) (every second):

window.setInterval(hideWebPartIfNoChildren, 1000);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.