I am trying to use Grid.js to create a table of data in a Flask app I am building. Grid.js has a checkbox plugin which uses the Redux architecture so that each selection instance keeps the list of selected rows within a Store.
I am following the example code located here: https://gridjs.io/docs/plugins/selection/selection-events
My code can be seen below:
grid.on('ready', () => {
// find the plugin with the give plugin ID
const checkboxPlugin = grid.config.plugin.get('selectRow');
// read the selected rows from the plugin's store
checkboxPlugin.props.store.on('updated', function (state) {
console.log('checkbox updated', state);
});
});
</script>
<form method="POST" action="{{ url_for('about') }}">
<button name="activity" class="btn btn-danger" type="submit" value={{state}}></button>
</form>
When I select a checkbox the console.log displays the information I want to access in the console. However I do not know how to assign it to a variable so that I can then use a button to send it back to my Flask app in python using a POST form.
Any help would be greatly appreciated.
This is a screenshot of my table, checkbox and value of 'state' which can be seen in the console