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

Filter in a Table #58

Open
MarcuzziGiuseppe opened this issue Sep 18, 2023 · 0 comments
Open

Filter in a Table #58

MarcuzziGiuseppe opened this issue Sep 18, 2023 · 0 comments

Comments

@MarcuzziGiuseppe
Copy link

Hi, I would like to be able to filter in a table but I can't understand how to connect the 2 things.
This is my table and I would not like to change it if possible:

Thanks to any help.

int selectedRow = -1;
static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable;
if (ImGui::BeginTable("table1", 3, flags)) {
ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("MARCA", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("DESCRIZIONE", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableHeadersRow();
for (int i = 0; i < pompeDisponibili.size(); i++) {
string testo = std::to_string(pompeDisponibili.at(i)->getId());
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGui::Selectable(testo.c_str(), selectedRow == i, ImGuiSelectableFlags_SpanAllColumns)) {
selectedRow = i;
}
testo = pompeDisponibili.at(i)->getMarca();
ImGui::TableNextColumn();
ImGui::Text(testo.c_str());
ImGui::TableNextColumn();
testo = pompeDisponibili.at(i)->getDescription();
ImGui::Text(testo.c_str());
}
}
ImGui::EndTable();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant