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

Comments for ARankingView #235

Merged
merged 9 commits into from
Nov 8, 2019
Merged

Comments for ARankingView #235

merged 9 commits into from
Nov 8, 2019

Conversation

keckelt
Copy link
Contributor

@keckelt keckelt commented Oct 24, 2019

I added some comments while integrating an ARankingView into our application. Mainly for the constructor and its parameters.

The init function required to pass an event listener, but I didn't need to handle these changes so I made it an optional parameter.

@keckelt keckelt added the type: docs Improvements or additions to documentation label Oct 24, 2019
@keckelt keckelt self-assigned this Oct 24, 2019
@@ -109,7 +109,7 @@ export abstract class AView extends EventHandler implements IView {
return null;
}

private buildParameterForm(params: HTMLElement, onParameterChange: (name: string, value: any, previousValue: any) => Promise<any>): Promise<IForm> {
private buildParameterForm(params: HTMLElement, onParameterChange?: (name: string, value: any, previousValue: any) => Promise<any>): Promise<IForm> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it optional now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The init function required to pass an event listener, but I didn't need to handle these changes so I made it an optional parameter.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I overlooked this sentence. but what do you mean with "but I didn't need to handle these changes so I made it an optional parameter."? in which application didn't you have to handle these changes?

you could also pass a function like () => null as an event listener. would this work for you?

is there a good reason making this parameter optional instead of passing a function doing nothing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RankingView already updates the content in the HTMLElement ("Showing 516 of 1013 Cell Lines; 11 selected"). I didn't have to update anything in our app based on this and therefore passed undefined.
That worked fine but I thought it will be clearer for future users if it is optional.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think I see the problem. the callback passed to init is actually to track parameter changes in the provenance graph, not for updating the lineup stats. the stats are updated here: https://github.com/datavisyn/tdp_core/blob/keckelt/comments/src/lineup/ARankingView.ts#L573-L588

the onParameterChange callback is actually used as an onChange callback when you define define parameter input elements by overriding https://github.com/datavisyn/tdp_core/blob/keckelt/comments/src/views/AView.ts#L136-L143 .

the ViewWrapper of tdp_core usually already handles passing the onParameterChange callback https://github.com/datavisyn/tdp_core/blob/keckelt/comments/src/base/ViewWrapper.ts#L163 - so this really is for detail views and therefore I wouldn't make it optional

I probably still misunderstand something... then I'll need more context about your application

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - I didn't use a ViewWrapper which might have made things unnecessary complicated: https://github.com/Caleydo/cohort/blob/87104e79a23585f8d919d5ee02aec3d76d9a682f/src/detail/DetailView.ts#L72-L98

@keckelt
Copy link
Contributor Author

keckelt commented Nov 7, 2019

I made the parameter non-optional again :)

@lehnerchristian lehnerchristian merged commit 7998c6b into develop Nov 8, 2019
@lehnerchristian lehnerchristian deleted the keckelt/comments branch November 8, 2019 11:55
@lehnerchristian
Copy link

nice, thanks! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants