views:

124

answers:

1

We have a page in a seam application using richfaces that contains an extendedDataTable plus one or more list boxes. We've found that, once you select something in the extendedDataTable and then switch to one of the list boxes, the extendedDataTable keeps responding to the up and down arrow keys, so if you use them to change the selection in the currently highlighted list box, the selection in the extendedDataTable changes as well.

Is there a workaround to stop the extendedDataTable changing selection when it doesn't have focus?

Unfortunatly the code is rather complex, but the xhtml for the table is (without all the columns for simplicity):

<rich:extendedDataTable id="jobManJobListTable" enableContextMenu="false"
      value="#{jobman_view.paginatedJobList}" var="job" rows="25" selectionMode="multi"
      selection="#{jobman_view.jobListSelection}" height="">

    <a4j:support event="onselectionchange" reRender="detailsDiv,customerDiv"
                 action="#{jobman_view.onJobSelectionChange()}"/>

    <rich:column width="10%" sortable="true" 
        label="#messages['jobman.ui.joblist.table.column.heading.type']}">
        <h:graphicImage value="../img/job_type_#{job.jobType.imageName}_16x16.png"/>
        <rich:toolTip>
            <span style="white-space: nowrap">
                <strong>#{job.jobType.name}</strong>
            </span>
        </rich:toolTip>
    </rich:column>

</rich:extendedDataTable>

Note the table is not included in any of the divs listed in the a4j:support Rerender.

As for the backing bean, the paginatedJobList is just a list of jobs, onJobSelectionChange changes job the backing bean thinks is selected so that the detail div's contain the correct data when reRendered, and jobListSelection is just a getter/setter for a SimpleSelection.

It seems to be related to the a4j:support, without it the selection doesn't apear to change when another control has focus.

A: 

You can write a smart JS function and attach it to onkeypress attribute of the extendedDataTable

This function could disable the scrolling when something is selected, and enable back to it when nothing is selected.

pakore