Hi,
Thanks for your help – truly appreciated.
Now, I am in the last stage of this problem, ie I have to save the
data from the dataTable into a new file and in new Class structure. It
may be straight forward, anyway, I explain what I am trying to do.
The following is the snapshot of my dataTable:
<t:dataTable id="applicantsData"
……
……
var="application"
value="#{applicationProcess.applications}"
border="1"
preserveDataModel="false">
<h:column>
<f:facet name="header"><h:outputText value="Selected"/></f:facet>
<t:selectBooleanCheckbox forceId="true" id="chk"
onclick="onChangeSelect(this);"
value="#{applicationProcess.selected}"/>
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="First Name"/></f:facet>
<h:outputText value="#{application.firstName}"/>
</h:column>
Surname,
Class
….
</t:dataTable>
The dataTable is using applicationProcess.applications list, which is
a list of Applicant object. Applicant Object has firstName, surname,
class, etc. and I have added <t:selectBooleanCheckBox> to determine if
the individual applicants are selected (and its value ie
applicationProcess.selected is not the property of Applicant Class).
What I have to do is iterate on the rows of dataTable and if the
<selectBooleanCheckbox> is checked, put it in another List. How can I
do this?
In the following,say:
public void saveData(ActionEvent event){
FacesContect context=FacesContext.getCurrentInstance();
List aList=event.getComponent()…..
…..
In the above, does event returns List from the dataTable? The value
of <selectBooleanCheckbox> ie applicationProcess.selected is not the
property of <Applicant> class, is it going to be the problem>
Any pointers would be highly appreciated, and sorry for lengthy and
too novice questions.
With regards,
Damar
On 11/8/06, Damar Thapa <[EMAIL PROTECTED]> wrote:
Hi,
I found a typo "instead of onchange I had typed onChange, and it was
causing the problem of not executing the valueChange method. Sorry for
this and thanks for your help.
With regards,
Damar
On 11/8/06, Damar Thapa <[EMAIL PROTECTED]> wrote:
> Hi,
>
> It is me again. Just to confirm that valuechange-method is not called
> -- console shows no actions. How can I ensure that it is called?
>
> With regards,
>
> Damar
>
> On 11/8/06, Damar Thapa <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > since no values are displayed at all, possibly valuechange-method is
> > not called. I have put the binding - thanks. How can I check if the
> > method is called? Sorry, this is my very first JSF application.
> >
> > Thanks once again.
> >
> > With regards,
> >
> > Damar
> >
> > On 11/8/06, Gerald Müllan <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > you mean the new list is not re-displayed?
> > >
> > > Is the valuechange-method called? You have given a wrong binding (left
> > > out the #{ } ), in this case maybe thats the problem.
> > >
> > > regards,
> > >
> > > Gerald
> > >
> > > On 11/7/06, Damar Thapa <[EMAIL PROTECTED]> wrote:
> > > > Thanks for your message. But, there is no validation error.
> > > >
> > > > With regards,
> > > >
> > > > Damar
> > > >
> > > > On 11/7/06, Jeff Bischoff <[EMAIL PROTECTED]> wrote:
> > > > > Have you checked to make sure there are no validation errors?
> > > > >
> > > > > Damar Thapa wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I have managed to workout with dataTable now; thank you. But, I
have a
> > > > > > question about ValueChage event.
> > > > > >
> > > > > > I have the following snapshot:
> > > > > >
> > > > > > <h:selectOneMenu value="#{applicationProcess.courseTitle}"
> > > > > > onChange="submit();"
> > > > > > valueChangeListener="applicationProcess.changeApplicationList"
> > > > > > immediate="true">
> > > > > > <f:selectItems value="#{applicationProcess.courses}"/>
> > > > > > </h:selectOneMenu>
> > > > > >
> > > > > > <t:dataTable
> > > > > > id="applicantsData"
> > > > > > styleClass="scrollerTable"
> > > > > > headerClass="standardTable_Header"
> > > > > > footerClass="standardTable_Header"
> > > > > > rowClasses="standardTable_Row1,standardTable_Row2"
> > > > > >
columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
> > > > > >
> > > > > > var="applications"
> > > > > > value="#{applicationProcess.applications}"
> > > > > > border="1"
> > > > > > preserveDataModel="false">
> > > > > > <h:column>
> > > > > > <f:facet name="header"><h:outputText value="Selected"/></f:facet>
> > > > > > <t:selectBooleanCheckbox value="#{applicationProcess.selected}"/>
> > > > > > </h:column>
> > > > > > …..
> > > > > > ……
> > > > > >
> > > > > > In the above, changeApplicationList (value change method) changes
the
> > > > > > list of applications list that is used by dataTable to display
> > > > > > applications. The following is the snapshot of my
> > > > > > changeApplicationList method (ValueChangeEvent):
> > > > > >
> > > > > > String course=(String) event.getNewValue();
> > > > > > java.util.ArrayList list=new java.util.ArrayList();
> > > > > >
> > > > > > while (result.hasNext()){
> > > > > >
> > > > > > fill list with application….
> > > > > > ----
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > > this.setApplications(list);
> > > > > > }
> > > > > > }
> > > > > >
> > > > > > My question is what triggers to render/re-render dataTable when
value
> > > > > > is change in <SelectOnMenu>? Mine is not working.
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Damar
> > > > > >
> > > > > >
> > > > > > On 11/7/06, Jeff Bischoff <[EMAIL PROTECTED]> wrote:
> > > > > >> Well yeah, though he probably wants check boxes, to be able to
select
> > > > > >> several at once. In that case, you can have a dataTable column
like:
> > > > > >>
> > > > > >> <h:column>
> > > > > >> <f:facet name="header"><h:outputText
value="Selected"/></f:facet>
> > > > > >> <t:selectBooleanCheckbox value="#{data.selected}"/>
> > > > > >> </h:column>
> > > > > >>
> > > > > >> Gerald Müllan wrote:
> > > > > >> > Hi,
> > > > > >> >
> > > > > >> > well, there should be a more nicer solution in order to achieve
this.
> > > > > >> > Have a look at the sandbox-examples page. An addition to
t:dataTable
> > > > > >> > does exist to get one row selected:
> > > > > >> >
> > > > > >> > http://example.irian.at/example-sandbox-20061106/selectOneRow.jsf
> > > > > >> >
> > > > > >> > Should be exactly what you need?
> > > > > >> >
> > > > > >> > cheers,
> > > > > >> >
> > > > > >> > Gerald
> > > > > >> >
> > > > > >> > On 11/6/06, Jeff Bischoff <[EMAIL PROTECTED]> wrote:
> > > > > >> >> Damar,
> > > > > >> >>
> > > > > >> >> I would say yes, dataTable is the right component for that. I
have at
> > > > > >> >> some point done all three items which you wish to do. As for
some
> > > > > >> >> pointers... well there is this [1], though I have a table with
> > > > > >> >> checkboxes, and I didn't need any javascript.
> > > > > >> >>
> > > > > >> >> [1] http://wiki.apache.org/myfaces/ManagingCheckboxes
> > > > > >> >>
> > > > > >> >> Regards,
> > > > > >> >>
> > > > > >> >> Jeff Bischoff
> > > > > >> >> Kenneth L Kurz & Associates, Inc.
> > > > > >> >>
> > > > > >> >> Damar Thapa wrote:
> > > > > >> >> > Hi,
> > > > > >> >> >
> > > > > >> >> > I have the following snapshot of my page:
> > > > > >> >> >
> > > > > >> >> > <h:selectOneMenu value="#{applicationProcess.courseTitle}">
> > > > > >> >> > <f:selectItems value="#{applicationProcess.courses}"/>
> > > > > >> >> > </h:selectOneMenu>
> > > > > >> >> >
> > > > > >> >> > <t:dataTable var="applicants"
> > > > > >> >> > value="#{applicationProcess.applications}" border="1"
> > > > > >> >> > preserveDataModel="true">
> > > > > >> >> > <t:column>
> > > > > >> >> > <h:outputText value="#{applicants.firstName}"/>
> > > > > >> >> > </t:column>
> > > > > >> >> > ……..
> > > > > >> >> > ….
> > > > > >> >> >
> > > > > >> >> > </t:dataTable>
> > > > > >> >> >
> > > > > >> >> > <h:commandButton action="processSelectedItem"
value="DoSomthing"/>
> > > > > >> >> >
> > > > > >> >> > Basically, what I have to do:
> > > > > >> >> >
> > > > > >> >> > (1) I choose the option in <selectOnMenu> option, and based
on the
> > > > > >> >> > option chosen here, it brings in the relevant data in
<dataTable>.
> > > > > >> >> >
> > > > > >> >> > (2) The rows (records) displayed in <dataTable> has to be
> > > > > >> selectable,
> > > > > >> >> > possibly with check boxes, and
> > > > > >> >> >
> > > > > >> >> > (3) After completing records selections in <dataTable>, I
click
> > > > > >> >> > <commandButton>, which will trigger the event that processes
the
> > > > > >> >> > selected records.
> > > > > >> >> >
> > > > > >> >> > How do I do this? Is DataTable right component for this
purpose? How
> > > > > >> >> > can I make record in dataTable selectable with checkboxes? Any
> > > > > >> >> > examples on this?
> > > > > >> >> >
> > > > > >> >> > Any pointers would be highly appreciated.
> > > > > >> >> >
> > > > > >> >> > With regards,
> > > > > >> >> >
> > > > > >> >> > Damar
> > > > > >> >> >
> > > > > >> >> >
> > > > > >> >> >
> > > > > >> >>
> > > > > >> >>
> > > > > >> >>
> > > > > >> >
> > > > > >> >
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > With regards,
> > > >
> > > > Damar Thapa
> > > >
> > >
> > >
> > > --
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> >
> >
> > --
> > With regards,
> >
> > Damar Thapa
> >
>
>
> --
> With regards,
>
> Damar Thapa
>
--
With regards,
Damar Thapa
--
With regards,
Damar Thapa