2 Replies Latest reply on Feb 25, 2013 2:54 PM by Asle Frantzen

    Hiding empty webparts based on producing treeview outputs


      We are trying to configure a SharePoint page so that if an element in the PI TreeView hierarchy does not pass reference information to consuming PI WebParts on a page, those web parts display as hidden.  What sort of output is produced from the PI TreeView that can be used?  Would this be easier to try and read a setting/flag within the other web parts themselves?  Has anyone else ever done a similar edit/modification to their SharePoint sites?




      We have a PI TreeView web part displaying a hierarchy with 2 elements.  Both elements have the same pair of graphic reference attributes but element 1 only has one reference value while element 2 has both references with values.


      The page has 2 PI Graphic web parts, each linked respectively to the attributes from the PI TreeView elements.


      When element 1 is selected only the PI Graphic with a reference is displayed and is populated, but when element 2 is selected both the PI Graphic web parts become visible and are populated.




      Thank you in advance.

        • Re: Hiding empty webparts based on producing treeview outputs

          Hi Grainger,


          this should be a little bit tricky.  the "link" function for PI webparts between PI TreeView and PI Graphic is provided by MS Sharepoint server actually.  Therefore, if needs to achieve your goal, modifying the sharepoint server configuration should be necessary.  I will check on the internet if there has the solution.


          Xi Wang

            • Re: Hiding empty webparts based on producing treeview outputs
              Asle Frantzen



              To achieve what you want you'll have to create a "man-in-the-middle" webpart. This will be a webpart without any GUI, which would need to implement the IParametersOutConsumer and IParametersOutProvider interfaces in order to communicate with the PI Webparts. You can then communicate with the PI Webparts client side, without the need to refresh the page every time a new selection is done.


              Your custom webpart can then assess if the conditions are met, and then modify the visibility settings of other DOM elements on the page - using javascript. I haven't tried this exact way myself, but it should be possible.


              Another, much simpler solution could be to just set the Chrome Type of the PI Graphics webpart to 'None'. This way the only thing visible in the webpart would be a small text saying "No Data Configured". You could also try experimenting with creating a default SVG file which contains nothing, by showing that it would appear that the webpage is empty where the PI Graphic webpart is placed.


              I see there is a setting in the PI Graphic webpart where it takes an XSL file. Since XSL is a powerful programming language I suppose you could determine if the reference is valid there, and then output the default, empty SVG if not valid.