ICEfaces
  1. ICEfaces
  2. ICE-9616

ace:dataTable - Horizontal scroll issue with header contents that are absolutely positioned

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: EE-3.2.0.GA, EE-3.3.0.GA, EE-3.3.0.GA_P01
    • Fix Version/s: EE-3.3.0.GA_P02, 4.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      All
    • Assignee Priority:
      P3
    • Salesforce Case Reference:
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      Workaround 1

      Make relative-positioned the parent of the element that you wish to make absolute-positioned. For example...

      .ui-datatable-scrollable-header table thead tr th div {
      position:relative;
      }

      Workaround 2

      Instead of...

      <span style="position:absolute;">

      The following can be used:

      <span style="display:block; width:150px;">

      This will widen the table column to the specified width. They just have to choose a width that is enough to fit all the text and images they want to include in the column header.
      Show
      Workaround 1 Make relative-positioned the parent of the element that you wish to make absolute-positioned. For example... .ui-datatable-scrollable-header table thead tr th div { position:relative; } Workaround 2 Instead of... <span style="position:absolute;"> The following can be used: <span style="display:block; width:150px;"> This will widen the table column to the specified width. They just have to choose a width that is enough to fit all the text and images they want to include in the column header.

      Description

      The header contents of a column are set to use "position: absolute". This table is also in a container that allows for horizontal scrolling. When scrolling horizontally the absolutely position contents are scrolled along with the scrollbar and not kept in the correct location.

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case source code that shows this behavior.

        Show
        Arran Mccullough added a comment - Attached test case source code that shows this behavior.
        Hide
        Arturo Zambrano added a comment -

        This is not a situation particular to the ace:dataTable. This is the way things work in HTML in general. Absolute-positioned items are outside of the normal flow of content, and therefore their position doesn't change when the rest of the content moves. It's not the case that the absolute-positioned item moves with the scrollbar; it's the other contents that moves while the absolute-positioned item stays in the same place.

        A quick plain-HTML example that demonstrates this fact is the following:

        <div style="border:1px #000 solid;width:200px;height:150px;overflow:auto;">
        <div style="position:absolute;color:#f00;">position absolute</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        <div>default position</div>
        </div>
        

        So, this is not an issue that has to be "fixed" necessarily in the component code. A better workaround consists in making the closest parent of the absolute-positioned span have position:relative. Since, the positions of absolute-positioned elements are determined relative to the closest positioned container (absolute or relative), and relative-positioned elements stay in the normal flow of content, by making the closest ancestor relatively positioned, the absolutely positioned span will determine its position relative to this ancestor and not relative to the scrollable container, so when scrolling the table, this ancestor will move with the rest of the content, "carrying" its absolute-positioned child. The CSS to add to the page looks like this:

        .ui-datatable-scrollable-header table thead tr th div {
        	position:relative;
        }
        

        We could consider adding this CSS to our stylesheets, so that all header cells are relative-positioned. However, it is uncertain whether this change will affect other scenarios or existing applications.

        Show
        Arturo Zambrano added a comment - This is not a situation particular to the ace:dataTable. This is the way things work in HTML in general. Absolute-positioned items are outside of the normal flow of content, and therefore their position doesn't change when the rest of the content moves. It's not the case that the absolute-positioned item moves with the scrollbar; it's the other contents that moves while the absolute-positioned item stays in the same place. A quick plain-HTML example that demonstrates this fact is the following: <div style= "border:1px #000 solid;width:200px;height:150px;overflow:auto;" > <div style= "position:absolute;color:#f00;" > position absolute </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> <div> default position </div> </div> So, this is not an issue that has to be "fixed" necessarily in the component code. A better workaround consists in making the closest parent of the absolute-positioned span have position:relative. Since, the positions of absolute-positioned elements are determined relative to the closest positioned container (absolute or relative), and relative-positioned elements stay in the normal flow of content, by making the closest ancestor relatively positioned, the absolutely positioned span will determine its position relative to this ancestor and not relative to the scrollable container, so when scrolling the table, this ancestor will move with the rest of the content, "carrying" its absolute-positioned child. The CSS to add to the page looks like this: .ui-datatable-scrollable-header table thead tr th div { position:relative; } We could consider adding this CSS to our stylesheets, so that all header cells are relative-positioned. However, it is uncertain whether this change will affect other scenarios or existing applications.
        Hide
        Arturo Zambrano added a comment -

        Resolving as Won't Fix. Use suggested workarounds.

        Show
        Arturo Zambrano added a comment - Resolving as Won't Fix. Use suggested workarounds.

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: