How to hide a column during printing a page using qListView webpart ? - SharePoint Customization - SharePoint for All - Dell Community

How to hide a column during printing a page using qListView webpart ?

How to hide a column during printing a page using qListView webpart ?

This question is not answered

Hi,

I would like to hide 'Edit' column during the printout of a page that has multiple 'qlistView' web-parts. 

Is there a way with custom script or CSS that this can be achieved?

Thanks.

All Replies
  • Hello,

     

    Do you mean hide the edit buttons in the print page? if yes, it should have the chance to use the script hide them before you print. If you need the sample, please let me know.

     

    Kenny.

  • Hi Kenny,

    Thank you for your reply. This is precisely what I am looking for. If you can share the script would be great.

    Just to reiterate I have a pages that use multiple pListView webparts and I would like to use some script/css to hide the 'Edit' column from all of those during printing. Please review the attached image for a sample webpart.

    Thanks,

    Mandeep

  • Hi Mandeep,

     

    qListView uses a script function to print the page, so you need to modify this function to hide the button. Firstly, you need to navigate to the script file, the default path is: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\wpresources\WA.DataViewer. but if you deployed the Quick Apps to the farm, you need to modify this file in all the servers. Open this file, locate to this fuction: GeneratePrintContent(webPartID, cssFiles, titleOfPrint), add below code into this function:

     

    htmlContent += '<script src="/_layouts/15/QuestSoftware/JQuery/jquery-1.8.2.min.js"></script>';

    htmlContent += '<script>$(document).ready(function(){var eidtButtons = $("img[src$=\'edititem.gif\']"); $.each(eidtButtons, function(index, btn){$(btn).css("display","none");})})</script>';

     

    I assume you are using SP2013, so the jQuery path is under the ‘15’, if you are using SP2010, please remove the ‘15’ section. These code is using the CSS to hide all the buttons in the page.

     

    Kenny.