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

Tables: Fix sorting order in demo->tables->sorting #3023

Closed
wants to merge 25 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d98b226
Tables: Initial commit. [Squashed 123+5 commits from tables_wip/]
ocornut Dec 19, 2019
5df135f
Tables: Initial demo code.
ocornut Dec 19, 2019
23cd2a5
Tables: Support for multiple Tables using same id where most settings…
ocornut Dec 26, 2019
5d07efe
Tables: Columns with no policy in a scrolling table will default to W…
ocornut Dec 28, 2019
2cd8658
Tables: Handle columns clipped due to host rect
ocornut Dec 28, 2019
aedf5f5
Tables: Double-clicking on fixed column to resize. Extracted code Beg…
ocornut Dec 28, 2019
27cd228
Tables: Comments, better assert, moved some internal flags out of the…
ocornut Dec 29, 2019
0d8b507
Tables: Return false when window is Collapsed (consistent + helpful f…
ocornut Dec 29, 2019
f2ee728
Tables: Disable initial output prior to NextRow call to avoid mislead…
ocornut Dec 29, 2019
46a2ed4
Tables: Demo: Moved Columns section into Tables & Columns section und…
ocornut Dec 29, 2019
e461feb
Tables: Fix scroll when releasing resize for multi-instances. Comment…
ocornut Dec 30, 2019
bb940e8
Tables: Separating inner/outer borders flags per axis so it is possib…
ocornut Dec 30, 2019
b3321a9
Tables: Moved border colors to the Style (maybe temporarily?) instead…
ocornut Dec 30, 2019
26a4060
Tables: Clarify internal calculations of row height so that TableGetC…
ocornut Jan 2, 2020
3fc8d8d
Tables: Fix reordering across hidden columns. Fix for frozen columns …
ocornut Jan 3, 2020
955bd4f
Tables: Support for multi-line columns name. Renaming of some fields …
ocornut Jan 6, 2020
aa605a5
Tables: Fix for hiding first column (fix fcceff5c + reading PrevLineT…
ocornut Jan 6, 2020
e4a663a
Tables: Storing per-column SkipItems as a shortcut. Comments, Spacings.
ocornut Jan 9, 2020
3c2b9d4
Tables: Made only first column honor Indent by default (like Columns …
ocornut Jan 9, 2020
9957652
Tables: Honor width/weight passed to TableSetupColumn() after .ini lo…
ocornut Jan 9, 2020
2ecb9fa
Tables: TableHeader() uses provided row min header rather than increm…
ocornut Jan 20, 2020
e773d03
Tables: Fixed headers closing popups.
ocornut Jan 22, 2020
0c2b772
Tables: Fixed content size calculation creating feedback loops. Fixed…
ocornut Feb 6, 2020
35d23cc
Tables: Added ImGuiTableFlags_NoKeepColumnsVisible wip flag useful fo…
ocornut Feb 10, 2020
0560b9e
fix sorting sign in demo->tables->sorting
piotrjurga Feb 13, 2020
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
Prev Previous commit
fix sorting sign in demo->tables->sorting
  • Loading branch information
piotrjurga committed Feb 13, 2020
commit 0560b9e32be9d3368a2daba76f28a14bf614db8b
10 changes: 5 additions & 5 deletions imgui_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2746,10 +2746,10 @@ struct MyItem
int delta = 0;
switch (sort_spec->ColumnUserID)
{
case MyItemColumnID_ID: delta = (a->ID - b->ID); break;
case MyItemColumnID_Name: delta = (strcmp(a->Name, b->Name)); break;
case MyItemColumnID_Quantity: delta = (a->Quantity - b->Quantity); break;
case MyItemColumnID_Description: delta = (strcmp(a->Name, b->Name)); break;
case MyItemColumnID_ID: delta = (b->ID - a->ID); break;
case MyItemColumnID_Name: delta = (strcmp(b->Name, a->Name)); break;
case MyItemColumnID_Quantity: delta = (b->Quantity - a->Quantity); break;
case MyItemColumnID_Description: delta = (strcmp(b->Name, a->Name)); break;
default: IM_ASSERT(0); break;
}
if (delta < 0)
Expand All @@ -2760,7 +2760,7 @@ struct MyItem

// qsort() is instable so always return a way to differenciate items.
// Your own compare function may want to avoid fallback on implicit sort specs e.g. a Name compare if it wasn't already part of the sort specs.
return (a->ID - b->ID);
return (b->ID - a->ID);
}
};
const ImGuiTableSortSpecs* MyItem::s_current_sort_specs = NULL;
Expand Down