Simon,

I am sorry that my post would cause inconvenience. I have posted this
question in both of the Forums as I didn't get any reply for my prevoious
questions when in 'MyFaces - Users' Forum. I would delete the one which I
posted in 'MyFaces - Dev' Forum.

Actually I am working on Trinidad, Oracle JDeveloper.

As you assumed tempCoreTable is not a componentBinding from the page.  
I have two selectManyListBoxes.  The requirement is that I need to construct
a dynamic page as follows:

panelGrid1
  |
  |__panelGrid
  |      |
  |      |__checkBox      // checkBox ids will be stored in a static
List<CoreSelectBooleanCheckbox> 
  |      |__inputText     // These Components will be rendered dynamically
based on number of selected 
  |                            // values in first selectManyListbox
  |__panelGrid
  |     |
  |     |__table            // User will enter data in these tables.  On
selection of checkbox and  based 
  |                            // number of selected values in second
selectManyListbox, the number of rows will 
  |__panelGrid             // be rendered in the table
  |      |
  |      |__checkBox
  |      |__inputText
  |
  |__panelGrid
         |
         |__table           // User will enter data in these tables.  On
selection of checkbox and  based 
                               // number of selected values in second
selectManyListbox, the number of rows will 
                               // be rendered in the table

   -------
  |  save |         // Button
   -------


I am getting a reference (of table) tempCoreTable by the following code:

for(int totalCheckboxCount = 0; totalCheckboxCount < chkboxlist.size();
totalCheckboxCount++) {
      List panelGridChildren =
chkboxlist.get(totalCheckboxCount).getParent().getParent().getChildren();
      HtmlPanelGrid tempHtmlPanelGrid =
(HtmlPanelGrid)panelGridChildren.get(childCount);
      CoreTable tempCoreTable =
(CoreTable)tempHtmlPanelGrid.getChildren().get(0);

     // Code in my previous post goes here.
}

"getSelectedRowKeys" is a method in <tr:table> component.

Thanks
Glen



Simon Kitching-4 wrote:
> 
> Glen,
> 
> Please do not post these sorts of question to the dev list. It belongs on
> the user list. And definitely do not post to both lists; most developers
> are also subscribed to the user list. Posting to both just annoys the
> people you are hoping will help you.
> 
> In JSF, it is very rarely necessary to "fetch" data from the components. I
> presume that tempCoreTable is a componentBinding to the table component
> from the page. Using component bindings is ugly and should be used only
> when nothing else will work.
> 
> Usually the best solution for this sort of problem is to modify the
> objects that the table is rendering. So the table is no longer passed a
> list of ServiceBean objects, but instead a list of ServiceBeanHandler
> objects. The ServiceBeanHandler can then hold the logic that handles
> updates for each row rather than using the loop below. The tempCoreTable
> binding variable can then be deleted.
> 
> I don't know what this "getSelectedRowKeys" method is. There is no such
> method on a UIData object. Is this from Trinidad, or are you trying to
> write your own custom UIComponent or ???
> 
> In the past I have implemented tables where a column holds a checkbox for
> each row that the user can click to select a row. I guess this is what you
> are doing. In this case, the ServiceBeanHolder class can add a boolean
> property to hold the selected/unselected state of that particular row,
> with the checkbox component just mapping to that property.
> 
> Regards,
> 
> Simon
> 
> ---- Glen <[EMAIL PROTECTED]> schrieb:
>> 
>> I have a problem with getting values of the inputText components from a
>> dynamically generated table.  Table will have inputText components in
>> each
>> cell.  The value entered by user should come to backing bean.
>> 
>> The following is the code that shows how I am trying to get the values:
>> 
>> 
>>             Iterator selectedRowKeys =
>> tempCoreTable.getSelectedRowKeys().iterator();
>>             while(selectedRowKeys.hasNext()) {
>>                 ServiceBean tableRow =
>> (ServiceBean)tempCoreTable.getRowData(Integer.parseInt(selectedRowKeys.next().toString()));
>>                 System.out.println("Weight :: " + tableRow.getWeight());
>>                 System.out.println("Minimum Value :: " +
>> tableRow.getMinValue());
>>                 System.out.println("Id :: " + tableRow.getDataID());
>>                 System.out.println("Name :: " + tableRow.getName());
>>             }
>> 
>> ServiceBean is a simple Java Bean that contains set of properties weight,
>> minValue, dataId, name and their get-set methods.  Also the rows in the
>> dynamically generated table are also of type ServiceBean.
>> Please help me to get out this problem.
>> -- 
>> View this message in context:
>> http://www.nabble.com/Issue-with-getting-the-values-of-the-rows-in-dynamically-generated-Table-tf4789818.html#a13702158
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Issue-with-getting-the-values-of-the-rows-in-dynamically-generated-Table-tf4789818.html#a13709347
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to