|
@@ -2678,18 +2678,19 @@ void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
|
// Write output
|
|
// Write output
|
|
table->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
|
|
table->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
|
|
ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;
|
|
ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;
|
|
- for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
|
|
|
- {
|
|
|
|
- ImGuiTableColumn* column = &table->Columns[column_n];
|
|
|
|
- if (column->SortOrder == -1)
|
|
|
|
- continue;
|
|
|
|
- IM_ASSERT(column->SortOrder < table->SortSpecsCount);
|
|
|
|
- ImGuiTableColumnSortSpecs* sort_spec = &sort_specs[column->SortOrder];
|
|
|
|
- sort_spec->ColumnUserID = column->UserID;
|
|
|
|
- sort_spec->ColumnIndex = (ImGuiTableColumnIdx)column_n;
|
|
|
|
- sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
|
|
|
|
- sort_spec->SortDirection = column->SortDirection;
|
|
|
|
- }
|
|
|
|
|
|
+ if (sort_specs != NULL)
|
|
|
|
+ for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
|
|
|
+ {
|
|
|
|
+ ImGuiTableColumn* column = &table->Columns[column_n];
|
|
|
|
+ if (column->SortOrder == -1)
|
|
|
|
+ continue;
|
|
|
|
+ IM_ASSERT(column->SortOrder < table->SortSpecsCount);
|
|
|
|
+ ImGuiTableColumnSortSpecs* sort_spec = &sort_specs[column->SortOrder];
|
|
|
|
+ sort_spec->ColumnUserID = column->UserID;
|
|
|
|
+ sort_spec->ColumnIndex = (ImGuiTableColumnIdx)column_n;
|
|
|
|
+ sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
|
|
|
|
+ sort_spec->SortDirection = column->SortDirection;
|
|
|
|
+ }
|
|
table->SortSpecs.Specs = sort_specs;
|
|
table->SortSpecs.Specs = sort_specs;
|
|
table->SortSpecs.SpecsCount = table->SortSpecsCount;
|
|
table->SortSpecs.SpecsCount = table->SortSpecsCount;
|
|
table->SortSpecs.SpecsDirty = true; // Mark as dirty for user
|
|
table->SortSpecs.SpecsDirty = true; // Mark as dirty for user
|