Table Column select #3918
NotDark
announced in
Old/Archived discussions
Replies: 2 comments
|
There are example in the demo. |
0 replies
|
In my case, the problem was calling int selected_id = -1;
for( size_t i = 0; i < data_items.size(); i++ ) {
ImGui::TableNextColumn( );
if( ImGui::Selectable( ( "##" + std::to_string( i ) ).c_str(), selected_id == i,
ImGuiSelectableFlags_SpanAllColumns )
) {
selected_id = i;
}
ImGui::SameLine();
ImGui::Text( "First Col" )
ImGui::TableNextColumn( );
ImGui::Text( "Second Col" )
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
{ ite *item = &itz[row]; const bool item_is_selected = selection.contains(item->id); ImGui::PushID(item->id); ImGui::TableNextRow(ImGuiTableRowFlags_None, 0.0f); ImGui::TableSetColumnIndex(0); ImGui::TextUnformatted(to_string(item->id).c_str()); if (ImGui::Selectable(to_string(item->id).c_str(), item_is_selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap, ImVec2(0, 0.0f))) { if (ImGui::GetIO().KeyCtrl) { if (item_is_selected) selection.find_erase_unsorted(item->id); else selection.push_back(item->id); } else { selection.clear(); selection.push_back(item->id); } } ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted(item->n.c_str()); ImGui::PopID(); }how do i make table column selectable
the code above create new row selectable
All reactions