Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.8k
CSV fragment#5727
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
CSV fragment#5727
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ian-r-rose commentedDec 10, 2018
It looks to me like the |
packages/csvviewer/src/widget.ts Outdated
| this.context.ready.then(()=>{ | ||
| this.content.goToLine(Number(topRow)); | ||
| }); | ||
| this.update(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I thinkthis.update() probably belongs inside yourthen(...) function since that is done asynchronously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks@afshin: I was actually wondering if it is needed at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think it is necessary at all, since the scrolling/viewport logic does not happen in theonUpdateRequest handler.
ian-r-rose left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This looks goods pretty good to me@lheagy, sorry for the slow turnaround (got pretty behind during the holidays).
The main thing we need to do to make this useful is fix the bug ingoToLine, which was not your fault, but does hamper this PR.
packages/csvviewer/src/widget.ts Outdated
| this.context.ready.then(()=>{ | ||
| this.content.goToLine(Number(topRow)); | ||
| }); | ||
| this.update(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think it is necessary at all, since the scrolling/viewport logic does not happen in theonUpdateRequest handler.
ian-r-rose commentedJan 8, 2019
goToLine(lineNumber: number){letscrollY=this._grid.scrollY;/* The lines might not all have uniform height, so we can't just scroll to lineNumber * this._grid.baseRowSize see https://github.com/jupyterlab/jupyterlab/pull/5523#issuecomment-432621391 for discussions around this. It would be nice if DataGrid had a method to scroll to cell, which could be implemented more efficiently because datagrid knows more about the shape of the cells. */for(leti=scrollY;i<lineNumber-1;i++){scrollY+=this._grid.sectionSize('row',i);}this._grid.scrollTo(this._grid.scrollX,scrollY);} Unless I am missing something, this is basically guaranteed to be wrong unless Instead, I think it should read something like goToLine(lineNumber: number){letscrollY=0;/* The lines might not all have uniform height, so we can't just scroll to lineNumber * this._grid.baseRowSize see https://github.com/jupyterlab/jupyterlab/pull/5523#issuecomment-432621391 for discussions around this. It would be nice if DataGrid had a method to scroll to cell, which could be implemented more efficiently because datagrid knows more about the shape of the cells. */for(leti=0;i<lineNumber-1;i++){scrollY+=this._grid.sectionSize('row',i);}this._grid.scrollTo(this._grid.scrollX,scrollY);} The big, honking warning about this method not being very efficient is still correct, but can be fixed another day. |
ian-r-rose commentedJan 8, 2019
Pinging@jasongrout again for comment. |
lheagy commentedJan 9, 2019
Thanks@ian-r-rose, and no worries on the delay - it is important to take a break over the holidays! I pushed a change that removes the unnecessary update. |
ian-r-rose commentedJan 10, 2019
@lheagy what do you think about updating |
lheagy commentedJan 10, 2019
Sure, I can take a crack at it :) |
ian-r-rose commentedJan 10, 2019
Thanks! |
lheagy commentedJan 11, 2019
Thanks@ian-r-rose: this resolved it! |
ian-r-rose commentedJan 11, 2019
Awesome, thanks@lheagy! |
ian-r-rose left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks great to me, thanks@lheagy
Fixes#5720
Implement a CSV
setFragmentfunction that scrolls to the requested row of a csv file.Currently only supports
rowrequests (notcolorcell,https://tools.ietf.org/html/rfc7111#section-3)TODO / Question:
If the CSV file is already open, this does not update which row is at the top, so I think I am missing a refresh or update step... Any pointers?
Thanks!
Thanks@ian-r-rose,@jasongrout,@ellisonbg,@AlbertHilb for patiently answering my questions 😄