I have managed to get a rough working version using a CustomJS callback with source.emit() and source.selected.emit().
However, the changes in the Datatable consistently lags by one interaction. Am trying to figure out what is causing this, and one possible reason would be that if .js_on_change is executed before .on_change (where the changes in the GroupFilter are processed), this would lead to the observed lag.
Could someone confirm what the execution order is?
Generally, the execution of the JS callback, and the websocket protocol message to trigger a Python callback occur roughly contemporaneously. But when the server callback actually executes can depend on many external factors (i.e. network or server load) that are not controllable. It’s probably the case that a JS callback executes first, most of the time. But things may be different for different models, depending on their implementations, the actual amount of work done in the various callbacks, network and load conditions.
TLDR; There are not any guarantees about order of JS callbacks vs Python callbacks, so I would advise not to try to rely on any specific order.