4 Replies Latest reply on Jul 1, 2009 11:18 AM by ARUN PRAKASH GANESAN

    Scrollable datatable and Auto scrolling on table rerender

    ARUN PRAKASH GANESAN Newbie

      I have a requirement where in i am trying to simulate an expandable data table inside a scrollable data table.

      I have the following structure

      Row 1
      [+] Row 2

      ..... until

      [-] Row 100
      Row 101

      When i try to expand row 100 the table rerenders but the scroll bar remains goes back to Row 1. Is there a way to be able to scroll down to the row i am trying to expand and collapse?

      -- Arun

        • 1. Re: Scrollable datatable and Auto scrolling on table rerende
          Ilya Shaikovsky Master

          yes. rerender not keeps the scroll position. see issues in jira marked with scrollable-dataTAble component.. There are some issues on such state saving improvements. Vote for them.

          • 2. Re: Scrollable datatable and Auto scrolling on table rerende
            Ilya Shaikovsky Master

            sorry.. simple reRender of the table with scrollbar fixed.. So I could see that scroll position not lost anymore at 3.3.2-SNAPSHOT. Could you please check?

            • 3. Re: Scrollable datatable and Auto scrolling on table rerende
              Ilya Shaikovsky Master

              And b.t.w. if the data is changed (actually rows count changed) we do not know where the scroll should be after update so it resets.

              • 4. Re: Scrollable datatable and Auto scrolling on table rerende
                ARUN PRAKASH GANESAN Newbie

                You are a 100% Right. The scroll position bug is fixed in 3.3.1 GA. So nothing to worry about.

                The scroll position remains in the same place if the data changes in the table. So i am not sure why you state the opposite.

                Here is another bug i found. I am not sure if it has something to do wit the data table or the a4j:commandlink

                <h:form>

                <a4j:jsFunction id="expandCollapseColumn" name="expandCollapseColumn" action="#{familyController.expandAndCollapse}" reRender="dynaColumn,expandCollapse,rowValue">

                <a4j:actionparam name="selectedRowId" assignTo="#{familyController.view.selectedRowId}"/>

                <a4j:actionparam name="selectedRowValue" assignTo="#{familyController.view.selectedRowValue}"/>
                </a4j:jsFunction>

                <rich:scrollableDataTable frozenColCount="#{familyController.view.frozenColCount}"
                height="500px" width="1200px" id="grid" rows="40"
                value="#{familyController.view.rows}" var="row"
                headerClass ="richDataTableHeaderFont"
                rowKeyVar="rowKey"
                hideWhenScrolling="true"
                >

                <rich:columns value="#{familyController.view.columns}" var="column"
                index="ind" id="dynaColumn">

                <f:facet name="header" >
                <h:outputText value="#{column.name}"
                styleClass="richDataTableHeaderFont"/>
                </f:facet>

                <a4j:commandLink id="expandCollapse" value="#{!row[ind].ref.expanded?'[ + ]':' [ - ]'}" onclick="expandCollapseColumn(#{rowKey},#{ind})" rendered="row[ind].ref.expandable"/>


                <h:outputText id="rowValue" value="#{row[ind].value}" />

                </rich:columns>
                </rich:scrollableDataTable>
                </h:form>


                In the above code the 2 things to notice are

                1. Scrollable data table rerenders the a4j:commandLink everytime the command link is clicked.

                2. When this happens, the a4j:commandLink rerenders but it does not check the "rendered=" condition.

                This might be a bug

                You can run the above using the following code i am attaching below.

                If the jboss user forum provides a way to attach files from my prototype i will be more than happy to attach them.