Filter
Filter data inside the table.
filter
Generates an input component that can filter rows for a target column based on its value. This property can be set using
a boolean
, a Filter
object or an array of Filter
objects to generate multiple filter components.
Example
- Sample code
- Full code
<active-table filter="true"></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
filter="true"
data='[
["Planet", "Diameter", "Mass", "Moons", "Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Jupiter", 142984, 1898, 79, 1326],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638]]'
tableStyle='{"borderRadius":"2px"}'
></active-table>
Types
Object types for filter:
Filter
- Type: {
caseButton?: boolean
,
dropdown?: boolean
,
defaultColumnHeaderName?: string
,
placeholderTemplate?: string
,
styles?: FilterStyles
,
position?: OuterContentPosition
,
order?: number
} - Default: {
caseButton: true,
dropdown: true,
placeholderTemplate: "Filter {headerName}...",
position: "top-right",
order: 1
}
Custom settings for a row filter input component.
caseButton
is used to toggle the visibility of a button that controls if row filtering is case sensitive.
dropdown
is used to toggle the visibility of a button that is used to display the column selection dropdown.
defaultColumnHeaderName
is the header name of the column that the filter will be targeting by default. If not set, it will use the first data column on the left.
placeholderTemplate
is a special template string that is used to control the input element's placeholder text. Inside the template - include the following substring
to denote where the column name will be set: "{headerName}". If your template string is "Filter {headerName}" and the target column's header name is "Brand",
the placeholder text will be "Filter Brand".
styles
is used to style the various elements inside the filter component.
position
is used to set the location of the filter component.
order
is the order of the component when other ones are also placed in the same position.
Example
- Sample code
- Full code
<active-table
filter='[
{
"caseButton": false,
"dropdown": false,
"defaultColumnHeaderName": "Mass",
"placeholderTemplate": "Filter by {headerName}",
"position": "top-left",
"order": 1
},
{
"caseButton": true,
"dropdown": true,
"defaultColumnHeaderName": "Planet",
"placeholderTemplate": "{headerName}",
"position": "top-left",
"order": 2
}
]'
></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
filter='[
{
"caseButton": false,
"dropdown": false,
"defaultColumnHeaderName": "Mass",
"placeholderTemplate": "Filter by {headerName}",
"position": "top-left",
"order": 1
},
{
"caseButton": true,
"dropdown": true,
"defaultColumnHeaderName": "Planet",
"placeholderTemplate": "{headerName}",
"position": "top-left",
"order": 2
}
]'
data='[
["Planet", "Diameter", "Mass", "Moons", "Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Jupiter", 142984, 1898, 79, 1326],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638],
["Mercury", 4879, 0.33, 0, 5429],
["Venus", 12104, 4.87, 0, 5243],
["Uranus", 51118, 86.8, 27, 1270]]'
tableStyle='{"borderRadius":"2px"}'
></active-table>
FilterStyles
- Type: {
input?: CSSStyle
,
placeholderColor?: string
,
caseIcon?:
StatefulCSS
& {active?: CSSStyle
},
dropdownIcon?:
StatefulCSS
& {active?: CSSStyle
}
}
Styling properties for a filter component.
input
defines the styling for the input element.
placeholderColor
is the color used for the placeholder text.
caseIcon
defines the styling for the various states of the element that toggles case sensitive filtering.
dropdownIcon
defines styling for the various states of the element that toggles the column selection dropdown.
Example
- Sample code
- Full code
<active-table
filter='{
"styles": {
"input": {"height": "22px", "fontSize": "15px", "width": "150px", "borderColor": "#818181", "color": "black"},
"placeholderColor": "grey",
"caseIcon": {
"default": {"color": "grey", "fontSize": "15px"},
"hover": {"color": "black"},
"click": {"color": "black"},
"active": {"color": "blue"}
},
"dropdownIcon": {
"default": {"color": "grey", "width": "18px", "height": "18px"},
"hover": {"color": "black"},
"click": {"color": "black"},
"active": {"color": "blue"}
}
}
}'
></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
filter='{
"styles": {
"input": {"height": "22px", "fontSize": "15px", "width": "150px", "borderColor": "#818181", "color": "black"},
"placeholderColor": "grey",
"caseIcon": {
"default": {"color": "grey", "fontSize": "15px"},
"hover": {"color": "black"},
"click": {"color": "black"},
"active": {"color": "blue"}
},
"dropdownIcon": {
"default": {"color": "grey", "width": "18px", "height": "18px"},
"hover": {"color": "black"},
"click": {"color": "black"},
"active": {"color": "blue"}
}
}
}'
data='[
["Planet", "Diameter", "Mass", "Moons", "Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Jupiter", 142984, 1898, 79, 1326],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638]]'
tableStyle='{"borderRadius":"2px"}'
></active-table>