Changing the visibility of a K2 SmartForms control is usually pretty straightforward, but when it comes to the visibility of a K2 ListView Column control, the solution might not be that obvious. This blog explains how to solve this problem using K2 SmartForms rules.
K2 Automated Testing Software
rnBenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.
The K2 SmartForms ListView control consists of different properties that all make up the physical ListView Column, and is each reachable as a separate control i.e. Column, Header and Body.
One of the options available to change a K2 SmartForms’ control’s properties can be found in the Control Interaction submenu on the Actions tab. This option works perfectly well when changing a control’s visibility and/or other properties, but the ListView Column control’s properties are not exposed in this option. You only have access to the Body, Header etc. properties and as a result can’t change the visibility of the column as a whole.
To specifically gain access to the K2 SmartForms ListView Column control’s visibility property, you have to add the Show / Hide a View control action in the Visibility submenu.
The rule is then configured and the K2 SmartForms ListView Column control’s visibility will be modified as per the K2 SmartForms rule specification.
This technique is useful for scenarios where the K2 ListView control is re-used by various K2 SmartForms, but based on the context of the data, columns need to be displayed or hidden. Sometimes the runtime visibility property needs to be updated to fulfil this requirement, and this done using the method described in this post.
About Velocity IT
Velocity IT is a UK based IT company that are business process architects and K2 masters. With over 15 years’ K2 design and development experience, we are the forefront of K2 solution design and implementation. Our K2 solutions have a user base of over 300,000+ users worldwide. Please visit velocity-it.com for more help and information.