WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
154050
Web Inspector: DataGrid Header Cells should have Context Menu for Sorting
https://bugs.webkit.org/show_bug.cgi?id=154050
Summary
Web Inspector: DataGrid Header Cells should have Context Menu for Sorting
Joseph Pecoraro
Reported
2016-02-09 15:12:49 PST
* SUMMARY DataGrid Header Cells should have Context Menu for Sorting * STEPS TO REPRODUCE 1. Inspect this page 2. Show Network tab 3. Right click a DataGrid header => expected sort options * NOTES - Should check if column is sortable
Attachments
Patch
(5.77 KB, patch)
2016-02-12 22:02 PST
,
Devin Rousso
joepeck
: review+
Details
Formatted Diff
Diff
Patch
(5.63 KB, patch)
2016-02-13 00:24 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Devin Rousso
Comment 1
2016-02-12 22:02:29 PST
Created
attachment 271270
[details]
Patch
Radar WebKit Bug Importer
Comment 2
2016-02-12 22:02:44 PST
<
rdar://problem/24642716
>
Radar WebKit Bug Importer
Comment 3
2016-02-12 22:02:45 PST
<
rdar://problem/24642717
>
Joseph Pecoraro
Comment 4
2016-02-12 23:38:59 PST
Comment on
attachment 271270
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=271270&action=review
r=me
> Source/WebInspectorUI/UserInterface/Views/DataGrid.js:956 > + _selectRowWithSortOrder(columnIdentifier, forcedSortOrder) > + { > + let determinedSortOrder; > + if (this.sortColumnIdentifier === columnIdentifier) { > + if (this.sortOrder !== WebInspector.DataGrid.SortOrder.Descending) > + determinedSortOrder = WebInspector.DataGrid.SortOrder.Descending; > + else > + determinedSortOrder = WebInspector.DataGrid.SortOrder.Ascending; > + } else > + this.sortColumnIdentifier = columnIdentifier; > + > + this.sortOrder = forcedSortOrder || determinedSortOrder; > + }
I think readability of this function is really poor. After reading the code below, the "toggling" case should really only happen in the clicked code and doesn't need to be here. I'd recommend something like: _toggledSortOrder() { return this._sortOrder !== WebInspector.DataGrid.SortOrder.Descending ? WebInspector.DataGrid.SortOrder.Descending : WebInspector.DataGrid.SortOrder.Ascending; } _selectSortColumnAndSetOrder(columnIdentifier, sortOrder) { this.sortColumnIdentifier = columnIdentifier; this.sortOrder = sortOrder; }
> Source/WebInspectorUI/UserInterface/Views/DataGrid.js:1068 > + this._selectRowWithSortOrder(cell.columnIdentifier);
Where this would be: let sortOrder = this._sortColumnIdentifier === cell.columnIdentifier ? this._toggledSortOrder() : this.sortOrder; this._selectSortColumnAndSetOrder(cell.columnIdentifier, sortOrder);
> Source/WebInspectorUI/UserInterface/Views/DataGrid.js:1189 > + if (cell && cell.columnIdentifier && cell.classList.contains(WebInspector.DataGrid.SortableColumnStyleClassName)) {
I think inside this block you should append a separator, to put the sort options in their own group. contextMenu.appendSeparator() Note, that OS X Mail has a "Sort By > ..." submenu. That could also be added here, with a Check Box next to the current sorted column and a Check Box next to Ascending / Descending. But what you just implemented was exactly what I was thinking when I filed this bug.
Devin Rousso
Comment 5
2016-02-13 00:24:24 PST
Created
attachment 271276
[details]
Patch Nice suggestion Joe!
WebKit Commit Bot
Comment 6
2016-02-13 01:23:40 PST
Comment on
attachment 271276
[details]
Patch Clearing flags on attachment: 271276 Committed
r196549
: <
http://trac.webkit.org/changeset/196549
>
WebKit Commit Bot
Comment 7
2016-02-13 01:23:42 PST
All reviewed patches have been landed. Closing bug.
Joseph Pecoraro
Comment 8
2016-02-13 01:37:03 PST
> Nice suggestion Joe!
I was super stoked to see this get fixed. I filed it intending to fix it quickly and totally forgot about it. Then I saw you had a patch up and couldn't stop smiling =). It was exactly what I was looking for!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug