-
15. Re: Getting clciked row in Extended datatable
shivaji.byrapaneni Jun 23, 2009 7:23 AM (in response to shivaji.byrapaneni)Thanks that helped
but i cant see the currentRow getting populated with the row value on which i made a click..?
could you please help me on thsi as well...? -
16. Re: Getting clciked row in Extended datatable
ilya_shaikovsky Jun 23, 2009 7:30 AM (in response to shivaji.byrapaneni)please paste actual code snippets every time when you get new problem. Maybe just errors in newest code and we can't see that just using the descriptions.
-
17. Re: Getting clciked row in Extended datatable
shivaji.byrapaneni Jun 23, 2009 7:39 AM (in response to shivaji.byrapaneni)Here is my JSP and bolded part is where exactly im placing the value contents of row to bean
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <!-- RichFaces tag library declaration --> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> <h:panelGrid columns="2" columnClasses="top,top"> <rich:messages /> <rich:extendedDataTable value="#{nominationSessionBean.coursesList}" id="courseListEDT" binding="#{courseListBean.courseListEDT}" var="course" width="700px" height="400px" sortMode="single" selectionMode="single"> <rich:column sortable="false" label="Course Image" width="40px" id="imageColumn" binding="#{courseListBean.imageColumn}"> <f:facet name="header"> <h:outputText value="" /> </f:facet> <h:graphicImage value="/Images/create_doc.gif" /> </rich:column> <rich:column sortable="true" sortBy="#{course.courseName}" filterBy="#{course.courseName}" filterEvent="onkeyup" width="170px" label="Course Name" id="courseNameColumn" binding="#{courseListBean.courseNameColumn}"> <f:facet name="header"> <h:outputText value="Course Name" /> </f:facet> <h:outputText value="#{course.courseName}" /> </rich:column> <rich:column sortable="true" sortBy="#{course.noOfSeats}" filterBy="#{course.noOfSeats}" filterEvent="onkeyup" width="170px" label="No Of Seats" id="noOfSeatsColumn" binding="#{courseListBean.noOfSeatsColumn}"> <f:facet name="header"> <h:outputText value="no Of Seats" /> </f:facet> <h:outputText value="#{course.noOfSeats}" /> </rich:column> <rich:column sortable="false" label="on Date" id="onDateColumn" binding="#{courseListBean.onDateColumn}"> <f:facet name="header"> <h:outputText value="on Date" /> </f:facet> <h:outputText value="#{course.onDate}" /> </rich:column> <rich:column sortable="false" label="Time" id="timeColumn" binding="#{courseListBean.timeColumn}"> <f:facet name="header"> <h:outputText value="Time" /> </f:facet> <h:outputText value="#{course.courseTime}" /> </rich:column> <rich:column sortable="false" label="location" id="locationColumn" binding="#{courseListBean.locationColumn}"> <f:facet name="header"> <h:outputText value="location" /> </f:facet> <h:outputText value="#{course.location}" /> </rich:column> <a4j:support event="onRowDblClick" reRender="courseListEDT" actionListener="#{courseListBean.nominateToTheCourse}"> <f:setPropertyActionListener value="#{course}" target="#{courseListBean.currentRow}" /> </a4j:support> </rich:extendedDataTable> </h:panelGrid>
and my backing bean ispackage com.managedbeans; import javax.ejb.EJB; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import org.richfaces.component.html.HtmlColumn; import org.richfaces.component.html.HtmlExtendedDataTable; import org.richfaces.model.selection.SimpleSelection; import com.constants.NominationConstants; import com.entities.CourseDetailsEO; import com.logger.NominationLogger; import com.services.local.CoursesInformationServiceLocal; public class CourseListBean extends NominationBaseBean { private final String className = this.getClass().toString(); @EJB(mappedName = NominationConstants.COURSEINFOSERVICE_LOCAL) private CoursesInformationServiceLocal coursesInformationService; private CourseDetailsEO currentRow; private HtmlExtendedDataTable courseListEDT; private HtmlColumn imageColumn; private HtmlColumn courseNameColumn; private HtmlColumn noOfSeatsColumn; private HtmlColumn onDateColumn; private HtmlColumn timeColumn; UIComponent formRoot = FacesContext.getCurrentInstance().getViewRoot() .findComponent("FormNameGoesHere"); public CourseDetailsEO getCurrentRow() { return currentRow; } public void setCurrentRow(CourseDetailsEO currentRow) { this.currentRow = currentRow; } public HtmlExtendedDataTable getCourseListEDT() { return courseListEDT; } public void setCourseListEDT(HtmlExtendedDataTable courseListEDT) { this.courseListEDT = courseListEDT; } public HtmlColumn getImageColumn() { return imageColumn; } public void setImageColumn(HtmlColumn imageColumn) { this.imageColumn = imageColumn; } public HtmlColumn getCourseNameColumn() { return courseNameColumn; } public void setCourseNameColumn(HtmlColumn courseNameColumn) { this.courseNameColumn = courseNameColumn; } public HtmlColumn getNoOfSeatsColumn() { return noOfSeatsColumn; } public void setNoOfSeatsColumn(HtmlColumn noOfSeatsColumn) { this.noOfSeatsColumn = noOfSeatsColumn; } public HtmlColumn getOnDateColumn() { return onDateColumn; } public void setOnDateColumn(HtmlColumn onDateColumn) { this.onDateColumn = onDateColumn; } public HtmlColumn getTimeColumn() { return timeColumn; } public void setTimeColumn(HtmlColumn timeColumn) { this.timeColumn = timeColumn; } public HtmlColumn getLocationColumn() { return locationColumn; } public void setLocationColumn(HtmlColumn locationColumn) { this.locationColumn = locationColumn; } private HtmlColumn locationColumn; public void loadCourseList() { final String methodName = "loadCourseList"; NominationLogger.logMethodEntry(className, methodName); getNominationSessionBean().setCoursesList(coursesInformationService.getCourseInfo()); NominationLogger.logMethodExit(className, methodName); // return NominationConstants.NominationHome; } public String nominateToTheCourse(ActionEvent event) { final String methodName = "nominateToTheCourse"; NominationLogger.logMethodEntry(className, methodName); NominationLogger.debug(courseListEDT.getSelection().toString()); SimpleSelection sel = (SimpleSelection)courseListEDT.getSelection() ; NominationLogger.debug(currentRow.toString()); NominationLogger.debug(courseListEDT.getRowData().toString()); NominationLogger.logMethodExit(className, methodName); return null; } }
many thanks for your help in advance -
18. Re: Getting clciked row in Extended datatable
ilya_shaikovsky Jun 23, 2009 9:40 AM (in response to shivaji.byrapaneni)change action listener to action or define with f:actionListener tag instead of attribute. This works as designed in JSF spec. Listener from support called first and nested listener (setPropertyActionListener) called then.
-
19. Re: Getting clciked row in Extended datatable
prasad.pokuri May 14, 2015 10:14 AM (in response to ilya_shaikovsky)Hi,
The same code is working fine if i tried to select the row in teh table for 5 times, In the 6th time when i am trying to get the row data am unable to get it.
here is my code.
<rich:extendedDataTable onclick="">
a4j:support id="onRowClickEventId" event="onRowClick"
onsubmit="workflowRegResultFormSetReqFunctionId('REGISTRATION_DATATABLE_ONSELECTION');changeColor(this);getDocumentDetails('#{item.lcmsg.docId}','#{item.lcmsg.source}','#{rowKey}');eventButtons(true);"
action="#{workflowRegistrationBean.selectRow}"
reRender="searchCriteriaFourth,searchCriteriaFiveth" ajaxSingle="false" oncomplete="getTableDocidReg(#{item.lcmsg.docId},'#{item.lcmsg.source}','#{rowKey}');workflowRegResultFormSetReqFunctionId('');">
<f:setPropertyActionListener value="#{item}"
target="#{workflowRegistrationBean.selectedItem}" />
<f:setPropertyActionListener value="#{rowKey}" target="#{workflowRegistrationBean.rowSelected}" />
</a4j:support>
</rich:extendeDataTable>