Class StringFilterBuilder

  • StringFilterBuilder helps create string filter controls for filtering data in Google Charts.

  • It offers options to control matching behavior, including case sensitivity, match type (exact, prefix, or any substring), and real-time triggering.

  • Developers can customize the filter by setting properties like caseSensitive, matchType, and realtimeTrigger.

  • The builder pattern allows for chaining methods for convenient and readable filter configuration.

  • Refer to the Gviz documentation for more in-depth information and examples.

StringFilterBuilder

A builder for string filter controls.

A string filter is a simple text input field that lets the user filter data via string matching. Given a column of type string and matching options, this control filters out the rows that don't match the term that's in the input field.

For more details, see the Gviz documentation.

Methods

MethodReturn typeBrief description
setCaseSensitive(caseSensitive)StringFilterBuilderSets whether matching should be case sensitive or not.
setMatchType(matchType)StringFilterBuilderSets whether the control should match exact values only (MatchType.EXACT), prefixes starting from the beginning of the value (MatchType.PREFIX), or any substring (MatchType.ANY).
setRealtimeTrigger(realtimeTrigger)StringFilterBuilderSets whether the control should match any time a key is pressed or only when the input field 'changes' (loss of focus or pressing the Enter key).

Detailed documentation

setCaseSensitive(caseSensitive)

Sets whether matching should be case sensitive or not.

// Builds a case insensitive string filter to filter column "Col1".
const stringFilter = Charts.newStringFilter()
                         .setFilterColumnLabel('Col1')
                         .setCaseSensitive(false)
                         .build();

Parameters

NameTypeDescription
caseSensitiveBooleanIf true, enables string matching case sensitivity.

Return

StringFilterBuilder — This builder, useful for chaining.


setMatchType(matchType)

Sets whether the control should match exact values only (MatchType.EXACT), prefixes starting from the beginning of the value (MatchType.PREFIX), or any substring (MatchType.ANY).

// Builds a string filter to filter column "Col1" matching the prefix.
const stringFilter = Charts.newStringFilter()
                         .setFilterColumnLabel('Col1')
                         .setMatchType(Charts.MatchType.PREFIX)
                         .build();

Parameters

NameTypeDescription
matchTypeMatchTypeThe string matching type.

Return

StringFilterBuilder — This builder, useful for chaining.

See also


setRealtimeTrigger(realtimeTrigger)

Sets whether the control should match any time a key is pressed or only when the input field 'changes' (loss of focus or pressing the Enter key).

// Builds a string filter to filter column "Col1" that checks the match any time
// a key is pressed.
const stringFilter = Charts.newStringFilter()
                         .setFilterColumnLabel('Col1')
                         .setRealtimeTrigger(true)
                         .build();

Parameters

NameTypeDescription
realtimeTriggerBooleanIf true, sets events to be triggered at real time (when a key is pressed).

Return

StringFilterBuilder — This builder, useful for chaining.