Skip to content

Best approach to sort table rows via stock TableWidget #743

Closed Answered by 38dh91
38dh91 asked this question in Q&A
Discussion options

You must be logged in to vote

@SolenOchHavet something like this:

if imgui.BeginTableV("##table", 2, getTableFlags(), vec2(0, 0), 0) {
  imgui.TableSetupScrollFreeze(0, 1)
  imgui.TableSetupColumnV("ID##table_col_id", imgui.TableColumnFlagsNoHide|imgui.TableColumnFlagsWidthFixed, imgui.CalcTextSize("00000000").X, 0)
  imgui.TableSetupColumnV("Text##table_col_text, 0, 0, 1)
  imgui.TableHeadersRow()
  
  // get table sort specs
  tableSorting := imgui.TableGetSortSpecs()
  if tableSorting.SpecsCount() != 0 {
    switch tableSorting.Specs().ColumnUserID() {
      case 1:
        logger.Info("%v", tableSorting.Specs().SortDirection())
    }
  }
  ...
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@SolenOchHavet
Comment options

@AllenDang
Comment options

@38dh91
Comment options

Answer selected by gucio321
@SolenOchHavet
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants