Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another approach to applying default filter/select settings on render #100

Draft
wants to merge 1 commit into
base: joe/feature/filter-select-default
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions inst/www/js/crosstalk.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions inst/www/js/crosstalk.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/js/crosstalk.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/js/crosstalk.min.js.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions javascript/src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class FilterHandle {
* @param {Object} [extraInfo] - Extra properties to be included on the event
* object that's passed to listeners (in addition to any options that were
* passed into the `FilterHandle` constructor).
*
*
* @fires FilterHandle#change
*/
clear(extraInfo) {
Expand All @@ -153,7 +153,7 @@ export class FilterHandle {
* @param {Object} [extraInfo] - Extra properties to be included on the event
* object that's passed to listeners (in addition to any options that were
* passed into the `FilterHandle` constructor).
*
*
* @fires FilterHandle#change
*/
set(keys, extraInfo) {
Expand Down Expand Up @@ -198,6 +198,14 @@ export class FilterHandle {
return this._emitter.off(eventType, listener);
}

invokeChangeHandler(extraInfo) {
const evt = this._mergeExtraInfo(extraInfo);
evt.value = this.filteredKeys;
evt.oldValue = null;

this._emitter.trigger("change", evt, this);
}

_onChange(extraInfo) {
if (!this._filterSet)
return;
Expand Down
8 changes: 8 additions & 0 deletions javascript/src/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ export class SelectionHandle {
return this._emitter.off(eventType, listener);
}

invokeChangeHandler(extraInfo) {
const evt = this._mergeExtraInfo(extraInfo);
evt.value = this.value;
evt.oldValue = null;

this._emitter.trigger("change", evt, this);
}

/**
* Shuts down the `SelectionHandle` object.
*
Expand Down
4 changes: 4 additions & 0 deletions javascript/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export class SubscriptionTracker {
return sub;
}

trigger(eventType, arg, thisObj) {
this._emitter.trigger(eventType, arg, thisObj);
}

removeAllListeners() {
let current_subs = this._subs;
this._subs = {};
Expand Down
Loading