如何通过鼠标单击选择rich:dataTable中的行?

时间:2010-09-16 16:26:28

标签: language-agnostic

我在一个modalPanel上有一个rich:dataTable以及两个名为OK和cancel的commandButtons。在其中一列我有单选按钮。选择单选按钮,然后单击“确定”。我可以选择那个特定的行。但我的要求是删除具有单选按钮的列。我想通过单击选择该行,然后单击确定。如果用户单击某行而不想选择该行,则只需单击“取消”。下面是用单选按钮实现功能的代码片段。

                                               

                                                        

   

      <h:outputText  id="selectAlarmToEnrich" value="#{bundle.modal_panel_label}" styleClass="staticTextLabelStyle"/>
      <div class="dataTableSetting">
      <rich:dataTable id="AlarmListTable" value="#{aeAlarmNEList.alarmInfoDTOList}"
 var="alarmsInfoDto"
 headerClass="table"
 styleClass="tagTable"
 rowClasses="odd,even"
 onRowMouseOver="this.style.backgroundColor='#A9D0F5'"    
                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'"
 rows="#{aeAlarmNEList.selectedRecordsPerPageCount}">

  <rich:column id="alarmId">
   <f:facet name="header">

   </f:facet>
   <input type="radio" name="alarmId"
   value="#{alarmsInfoDto.alarmId}" />
  </rich:column>

  <rich:column id="alarmTime">
   <f:facet name="header">
        <h:outputText value="#{bundle.modal_panel_alarm_time_header}"/>
   </f:facet>
   <h:outputText id="alarmTimeValue" value="#{alarmsInfoDto.alarmTime}" styleClass="nonEditableTableText"/>
  </rich:column>

  <rich:column id="alarmText" >
   <f:facet name="header">
        <h:outputText value="#{bundle.modal_panel_alarm_text_header}"/>
   </f:facet>

   <div class="ellipsis nonEditableTableText">
    #{alarmsInfoDto.alarmText}<br/>
   </div>

   <rich:toolTip rendered="#{alarmsInfoDto.DN != ' '}">
              <span style="white-space:nowrap">
                  <h:outputText id="alarmTextTooltip" value="#{alarmsInfoDto.alarmText}"   styleClass="nonEditableTableText"/>

             </span>
         </rich:toolTip>
  </rich:column>

  <rich:column id="alarmNumber">
   <f:facet name="header">
        <h:outputText value="#{bundle.modal_panel_alarm_num_header}"/>
   </f:facet>

   <h:outputText id="alarmNumberValue" value="#{alarmsInfoDto.specificProblem}" styleClass="nonEditableTableText"/>
  </rich:column>

  <rich:column id="alarmSeverity">
   <f:facet name="header">
        <h:outputText value="#{bundle.modal_panel_alarm_svrty_header}"/>
   </f:facet>

   <h:outputText id="alarmSeverityValue" value="#{alarmsInfoDto.perceivedSeverity}" styleClass="nonEditableTableText"/>
  </rich:column>

  

      

   <h:outputText id="total_number_of_alarms" value="Total: #{aeAlarmNEList.totalNumberOfObjects} Alarm(s)" style="font-size: 10pt;color: #000066;"/>
  </div>

  <div style="float: left;width: 50%;" >
    <rich:datascroller align="center" for="AlarmListTable" page="#{aeAlarmNEList.scrollerPage}"
     pagesVar="no_of_pages" id="scrollBar2" fastControls="hide">

      <f:facet name="first" >
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_first.gif" title="" />
      </f:facet>
      <f:facet name="first_disabled">
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_first.gif" title="" />
      </f:facet>
      <f:facet name="last" >
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_last.gif" title="" />
      </f:facet>
      <f:facet name="last_disabled">
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_last.gif" title="" />
      </f:facet>
      <f:facet name="next">
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_next.gif" title="" />
      </f:facet>
      <f:facet name="next_disabled">
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_next.gif" title="" />
      </f:facet>
      <f:facet name="previous">
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_previous.gif" title="" />
      </f:facet>
      <f:facet name="previous_disabled">
       <h:graphicImage style="cursor: pointer" url="/webuif/images/arrow_previous.gif" title="" />
      </f:facet>
      <f:facet name="pages">
          <h:panelGroup>
              <h:outputText value="Page " style="vertical-align: middle;"/>
              <t:inputText value="#{aeAlarmNEList.scrollerPage}" style="width:30px;height:18px;text-align:right;" forceId="true" id="currPageInput1" >
               <a4j:support event="onchange"  reRender="AlarmListTable, scrollBar2"/>
               </t:inputText>
              <h:outputText value=" / #{no_of_pages}" style="vertical-align: middle;"/>                         
          </h:panelGroup>
          </f:facet>
     </rich:datascroller>    
  </div> 

  <div style="float: right;width: 20%; text-align: right; margin-right:2px;">
     <h:outputText id="view_records_per_page_part2"
      value="10 Alarms per page" style="font-size: 10pt;color: #000066;" />
  </div>
 </div>

   

   

 

1 个答案:

答案 0 :(得分:0)

考虑将radiobutton与行中数据的标识符相关联。