useButton
The hook for applying actions against the Qlik engine, commonly attached to a button

Basic Example

The below example returns a function to clear selections in your Qlik application
const Button = () => {
const { clearSelections } = useButton();
return (
<button onClick={clearSelections}
>
Clear Selections
</button>
);
};
export default Button;

Button Options

No options can be passed into the hook

Button Properties

The following properties are returned from the hook
  • clearSelections: Function
    • Function to clear all selections
  • previousSelection: Function
    • Function to jump to the previous selection state
  • nextSelection: Function
    • Function to jump to the next selection state
  • select: Function(SearchText<string>, Field<string>)
    • Function to select values in a field
    • Pass a string to search for. Can contain wild cards or numeric search criteria
    • Second parameter is the field you are searching in
  • selectValues: Function(Selections<array>, Field<string>, Toggle<boolean>)
    • Selects some values in a field, by passing an array of values to select
    • The first parameter is an array of values to select, the second is the field
    • Third parameter is whether to toggle selections, defaults to false
    • Selects aan array of strings

Select Values Example

const Button = () => {
const { selectValues } = useButton();
const sel = ['France', 'Italy']
const field = 'country'
const select = () => (
selectValues(sel,field,false)
)
return (
<button onClick={select}>
Select Values
</button>
);
};
export default Button;
Last modified 1yr ago
Copy link
On this page
Basic Example
Button Options
Button Properties
Select Values Example