how to display the selected row from the data table in model panel ??

how to display the selected row from the data table in model panel ??

the below displayed is my datatable:tableDatas.xhtml

<rich:dataTable value="#{tableRecordBean.dataList}" var="dataItems" onRowClick="#{rich:component('md1')}.show()" onRowMouseOver="this.style.backgroundColor='#B5F3FB'" onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'" rowClasses="row1, row2, row3" id="taskList" rows="3" columnClasses="50,100,50" width="350">
    <f:facet name="caption">
        <h:outputText value="This is caption..." />
    </f:facet>

    <f:facet name="header"> 
        <h:outputText value="Student Study System" /> 
    </f:facet> 



    <rich:column>
        <f:facet name="header"> Student ID </f:facet>
        <h:outputText value="#{dataItems.stu_ID}" />        
    </rich:column>

    <rich:column>
        <f:facet name="header"> Student Name </f:facet>
        <h:outputText value="#{dataItems.stu_NAME}" />      
    </rich:column>

    <rich:column>
        <f:facet name="header"> ExamHall No. </f:facet>
        <h:outputText value="#{dataItems.ehall_NO}" />      
    </rich:column>
</rich:dataTable>    

</rich:simpleTogglePanel>

<rich:modalPanel id="md1" width="250" height="150">
    <f:facet name="header">
        Student Information
    </f:facet>


    <h:panelGrid id="studentInfo" columns="2">
        <h:outputText value="student ID" />
        <h:outputText value="#{dataItems.stu_ID}" />
        <h:outputText value="Exam Hall No:" />
        <h:outputText value="#{tableData.ehall_NO}" />
        <h:outputText value="Name:" />
        <h:outputText value="#{dataItems.stu_NAME}" />


    </h:panelGrid>
    <f:facet name="controls">
        <h:commandButton value="close" style="cursor:pointer" onclick="#{rich:component('md1')}.hide()" />
    </f:facet>

tTableRecordBean.java

package Datas;

import java.util.ArrayList; import java.util.Iterator;

//import javax.faces.event.ActionEvent; //import java.util.List;

public class TableRecordBean {

private ArrayList <TableData> dataList;
private ArrayList <TableData> selectList;


public void assignDataList()
{
    dataList= new ArrayList <TableData>();

    TableData rec1=new TableData(); 
    rec1.setStu_ID("G001");
    rec1.setStu_NAME("Kanna");
    rec1.setEhall_NO(100);

    TableData rec2=new TableData();
    rec2.setStu_ID("G002");
    rec2.setStu_NAME("Krishna");
    rec2.setEhall_NO(101);

    TableData rec3=new TableData();
    rec3.setStu_ID("G003");
    rec3.setStu_NAME("Karthik");
    rec3.setEhall_NO(102);

    dataList.add(rec1);
    dataList.add(rec2);
    dataList.add(rec3); 



}

public ArrayList <TableData> selected()
{

    Iterator<TableData> dataItr = dataList.iterator();

    while(dataItr.hasNext())
    {
        TableData td =dataItr.next();
        if((dataList.indexOf(td))==1);
        {
            selectList=dataList;
        }
        //System.out.println("Current :"+td.getStu_ID()+"\t"+td.getStu_NAME()+"\t"+td.getEhall_NO());
    }
    return selectList;

}

/*public void onClick()
{

    Iterator<TableData> dataItr = dataList.iterator();

    while(dataItr.hasNext())
    {
        Object obj=dataItr.next();
        System.out.println("Current :"+obj);
    }
}*/

public ArrayList <TableData> getDataList() {
    assignDataList(); 
    return dataList;
}

please help me out !~!!!!! i get the model panel but the values are unable to transfer to the model panel....

View Answers

October 10, 2011 at 11:31 AM

guys please help me out i am new to jsf.......i hope u all will help me on this issue and how can i use "rowkayvar"









Related Tutorials/Questions & Answers:

Ads