No announcement yet.
  • Filter
  • Time
Clear All
new posts

  • Suppress Header Span from canHide context menu when 1:1?

    I'm implementing a ListGrid filter mechanism based on simple icon buttons displayed in header spans. Header spans seemed to be the easiest way I found to achieve the appropriate 1:1 alignment of buttons with table columns. If there's some other approach, I'm interested.

    Since they're all 1:1 it doesn't make sense that in the field's context menu both the field and the header span appear so I'm looking for a way to only include one and not both. E.g., if I leave the header span's title or headerTitle to null or undefined, then I get the text "null" or "undefined" in the context menu.

  • #2
    There's currently no way to suppress headerSpans from the show/hide columns menu, partly because they are intimately connected (eg hiding all fields under a span needs to hide the span). You could override getHeaderContextMenuItems() and substitute your own submenu. If you continue down this path, you probably also want to set all of the showHeaderSpansTitlesIn* properties to false to keep the headerSpans out of other contexts too.

    Fundamentally this whole approach is a bit of a hack, as headerSpans are supposed to represent column groupings and you're using them for something else. You might consider either:

    1. let the headerSpans be normal headerSpans and just add your filter interface via adding an icon and implementing headerSpanClick

    2. don't use headerSpans, and just add your filtering interface above the normal headers via listGrid.gridComponents. Use fieldStateChanged to keep apprised of current field order and sizes to size your filter interface