|
|
|
@ -4456,14 +4456,42 @@ static void ShowDemoWindowTables() |
|
|
|
|
ImGui::TreePop(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Demonstrate creating multiple tables with the same ID
|
|
|
|
|
if (open_action != -1) |
|
|
|
|
ImGui::SetNextItemOpen(open_action != 0); |
|
|
|
|
if (ImGui::TreeNode("Synced instances")) |
|
|
|
|
{ |
|
|
|
|
HelpMarker("Multiple tables with the same identifier will share their settings, width, visibility, order etc."); |
|
|
|
|
for (int n = 0; n < 3; n++) |
|
|
|
|
{ |
|
|
|
|
char buf[32]; |
|
|
|
|
sprintf(buf, "Synced Table %d", n); |
|
|
|
|
bool open = ImGui::CollapsingHeader(buf, ImGuiTreeNodeFlags_DefaultOpen); |
|
|
|
|
if (open && ImGui::BeginTable("Table", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_ColumnsWidthFixed | ImGuiTableFlags_NoSavedSettings)) |
|
|
|
|
{ |
|
|
|
|
ImGui::TableSetupColumn("One"); |
|
|
|
|
ImGui::TableSetupColumn("Two"); |
|
|
|
|
ImGui::TableSetupColumn("Three"); |
|
|
|
|
ImGui::TableHeadersRow(); |
|
|
|
|
for (int cell = 0; cell < 9; cell++) |
|
|
|
|
{ |
|
|
|
|
ImGui::TableNextColumn(); |
|
|
|
|
ImGui::Text("this cell %d", cell); |
|
|
|
|
} |
|
|
|
|
ImGui::EndTable(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ImGui::TreePop(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Demonstrate using Sorting facilities
|
|
|
|
|
// This is a simplified version of the "Advanced" example, where we mostly focus on the code necessary to handle sorting.
|
|
|
|
|
// Note that the "Advanced" example also showcase manually triggering a sort (e.g. if item quantities have been modified)
|
|
|
|
|
static const char* template_items_names[] = |
|
|
|
|
{ |
|
|
|
|
"Banana", "Apple", "Cherry", "Watermelon", "Grapefruit", "Strawberry", "Mango", |
|
|
|
|
"Kiwi", "Orange", "Pineapple", "Blueberry", "Plum", "Coconut", "Pear", "Apricot" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// This is a simplified version of the "Advanced" example, where we mostly focus on the code necessary to handle sorting.
|
|
|
|
|
// Note that the "Advanced" example also showcase manually triggering a sort (e.g. if item quantities have been modified)
|
|
|
|
|
if (open_action != -1) |
|
|
|
|
ImGui::SetNextItemOpen(open_action != 0); |
|
|
|
|
if (ImGui::TreeNode("Sorting")) |
|
|
|
|