JS API: Utilities¶
To use these functions, add this to your HTML page:
<script src="/networktables/utils.js"></script>
The functions in this file are still experimental in nature, and as we expand the number of functions in this file it is expected that the API will change.
SendableChooser¶
-
attachSelectToSendableChooser
(html_id, nt_key)¶ Given the id of an HTML
<select>
element and the key name of a SendableChooser object setup in networktables, this will sync the select combo box with the contents of the SendableChooser, and you will be able to select an object using the select element.Arguments: - html_id – An ID of an HTML select element
- nt_key – The name of the NetworkTables key that the SendableChooser is associated with
See the WPILib documentation for information on how to use SendableChooser in your robot’s program.
-
updateSelectWithChooser
(html_id, nt_key)¶ This function is designed to be used from the onValueChanged callback whenever values from a SendableChooser change, but you probably should prefer to use attachSelectToSendableChooser instead.
See attachSelectToSendableChooser documentation.