We use visibility component when we want to hide components from form in some situations. This tutorial shows you how to hide component from form by using visibility component and Server function. In our example we will hide buttons Edit Product and Delete Product if there is no products in our database.
For this tutorial, you have to login into developer panel of your application.
1. Login into developer panel of application.
2. Click on Pages menu item.
3. Select page pageProduct.
4. Drag and drop Visibility component from all components list to component named buttonEditProduct that is located on table component named dataTableProduct.
5. In dropped visibility component properties, for Data source type property choose Server function.
6. Click on Data source Function field and on the left side of dialog window choose plugin. On the right side choose function. Function in plugin returns result variable. Variable result in plugin function is an instance of AjaxProxy class. Attribute status of result variable ($result->status) can be true or false. If you want to hide component, set attribute status to false. Click on Save button.
7. Repeat steps 4, 5 and 6 for component named buttonDeleteProduct.
8. Click on Save changes, go into your application and check out the results.