开发者

How to select a row in rich:dataTable by mouse click?

I have a rich:dataTable on one modalPanel alongwith two commandButtons named as OK and cancel. In one of the columns I have radio buttons. By selecting a radio button and then click OK. I am able to select that particular row. But my requirement is to delete the column which has radio button. I want to select the row by clicking on it and then OK. If user clicks on a row and does not want to select it then simply clicks Cancel. Below is the piece of code which implements the functionality with radio button.

      <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>
      开发者_如何学C<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>


Consider associating radiobutton with identifier of the data in the row.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜