Lesson 10: Adding Filters (Column Visibility)
A column filter enables one to show and hide the columns they need in the data-table at runtime. This is enabled with the Filter Columns. When one selects a column from the chips, its either shown / hidden in the data-table.
For the projects, there are some columns that have been flagged as "visible", these are all except, Planned Resource Costs, Planned Other Costs, Planned Total Costs, Actual Resource Costs, Actual Other Costs and Actual Total Costs.
By default, on the VueTable, the "All Columns Visible" is on, meaning that all columns should be visible, however to show / hide specific columns, one needs to uncheck the "All Columns Visible" property and then enter the field names to be visible in the Visible Column Fields.
So how can this be done with Incwadi yamaBali?
On the projects model, click "Edit" to activate the Model.
On the right drawer, ensure that, these options are set.
We do not want all the columns visible, column visibility will be controlled by checking on the chips. Has Filter ensures that the chip filters to control visibility is available. This can be visible/hidden and is also controlled by code, for example, when you want to control access for some users to be able to filter the columns / not.
The clear filter button will enable us to reset the filters to only show the master visible columns in the data-base.
Specifying fields that should be on the table and visible.
The next step is for this model to specify which fields should be on the table and which ones should be visible.
In the above image, we are indicating that the fields should be on the table and they should be visible. There are some fields that we want to be on the data-table, but we need them to be hidden.
So, whilst these columns,
Planned Resource Costs, Planned Other Costs, Planned Total Costs, Actual Resource Costs, Actual Other Costs and Actual Total Costs, will be on the table, they will not show, creating the filters we have specified.