Title: Message
Which then doesnt mean, we are violating the MVC model which the JSF is actually trying to achieve?
 
 -----Original Message-----
From: Dave [mailto:[EMAIL PROTECTED]
Sent: Friday, September 09, 2005 3:06 PM
To: MyFaces Discussion; [EMAIL PROTECTED]
Subject: RE: Selecting checkboxes in the backing bean

You are right on the coupling UI and data model. I found it more clean. Make sure the property is transient only for UI. :-)

Balaji Saranathan <[EMAIL PROTECTED]> wrote:
Hi,
 
Isnt there any other way to do it? Assuming, UserInfo is the member class of the collection (datamodel), why should a property exist on it, that is something to do with the presentation on the UI. It actually is not a property of the class at all. I think this would mean we couple UI and model tightly.
 
Therefore, on the backing bean, I have a class level variable UISelectBoolean selected as specified by Craig in this forum http://forum.java.sun.com/thread.jspa?forumID=427&threadID=486654 . This variable is bounded to the Checkbox.  As per my understanding, the dataTable internally handles the state of each checkbox mapped to this variable.
 
However, on my code I loop through the rows displayed and set the selected.setSelected(true). However, this doesnt seem to have any effect at all.
Note:
"table" here refers to an instance of UITable that is binded to the DataTable.
 
      int firstRow = table.getFirst();
      int numRows = table.getRows();
      for (int index = firstRow; index < (firstRow + numRows); index++)
      {
         table.setRowIndex( index );
        selected.setSelected(true);
      }
 
Thanks
Bala
-----Original Message-----
From: Dave [mailto:[EMAIL PROTECTED]
Sent: Friday, September 09, 2005 1:51 PM
To: MyFaces Discussion; [EMAIL PROTECTED]
Subject: Re: Selecting checkboxes in the backing bean

Add a property in backing bean data model(member class of collection) such as selected, and bind the checkbox to the property.

Balaji Saranathan <[EMAIL PROTECTED]> wrote:

Hi,

I have a page where there is a SelectOneMenu and a dataTable beneath. I would like to select a couple of rows in the dataTable based on the selection of the SelectOneMenu.

I have registered a ValueChangeListener to the SelectOneMenu and my method is getting called.

But how do I actually check the CheckBoxes created in the DataTable programatically based on one of the column information. Assuming I have a colum called name, and I have to select all the rows containing the name "XXX", how would I get a handle to the column rows and the checkboxes to select it.

Is looping through the UIViewRoot, the only way?

Does anyone have any ideas?

Thanks
Balaji



Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately
and destroy all copies of this message and any attachments.


Click here to donate to the Hurricane Katrina relief effort.


Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately
and destroy all copies of this message and any attachments.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately
and destroy all copies of this message and any attachments.

Reply via email to