I think the simplest way is to filter at the query level. Rebuild your 
datamodel when the filter criteria changes, based on the resultset that either 
includes or excludes in stock items, rather than hacking the hiding/showing of 
rows when rendering.

-----Original Message-----
From: William Huang [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 29, 2006 3:05 PM
To: MyFaces Discussion
Subject: Re: How to not display a row in <t:dataTable> based on the row content?

I haven't try this yet, but ideally, you would implement your own DataModel 
class by extending the javax.faces.model.DataModel or other subclasses.
Make sure you have the right logic in the getRowCount(), and getRowData(), in 
the getRowData() method, you can control which row to display or not display.  
make sure your getRowCount matches.  I think ideally, this is very similar to 
how java SWING table and its data model works as well.

Let me know if that helps,

William Huang
                                                                           
             delbd                                                         
             <[EMAIL PROTECTED]>                                                
                                                                        To 
             08/29/2006 02:04          MyFaces Discussion                  
             PM                        <[email protected]>          
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
                 "MyFaces              Re: How to not display a row in     
                Discussion"            <t:dataTable> based on the row      
             <[EMAIL PROTECTED]         content?                            
                 ache.org>                                                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




I played recently with datatable, and a custom component. The custom component 
was creating different children depending on the data itself, each row having a 
different data. That's how i discovered datatable is not very flexible. It 
creates only one set of children, reprensenting a rown ,and only change the 
rowindex and clientid between rows. So trying to 'hide' rows is quite 
difficult. There are 2 ways imho
- create a filtered collection (most easy way)
- create a custom component that better fits your needs John Ruffin a écrit :
> Try some permutation of this: rendered="#{not row.isInStock}" on your 
> components.  Not sure if you'll end up with blank rows or not.
>
>
> ::SammyRulez:: wrote:
>
>> can't u modify the business method that create the collaction of the 
>> value attriubute of the datattable.
>>
>> Before you ask is not possible to set rowstyle on particular var 
>> attribute values.
>>
>> My two cents is to put a image in a column with an icon that displays 
>> only if the item is in stock
>>
>>
>> 2006/8/29, Paul Spencer <[EMAIL PROTECTED]>:
>>
>>> I am have a list that is displayed by <t:dataTable>  I would like to 
>>> selectively display the object in that list, i.e. filter them, via 
>>> the JSP tag configuration.
>>>
>>> As an example the collection contains a list of parts.  The part 
>>> object also contains the method isInStock().  So the <t:dataTable> 
>>> should only display object where row.isInStock() is true.
>>>
>>> I know that a new list containing only inStock object can be created
and
>>> that list could be passed to <t:dataTable>, but I have simplified 
>>> the example for the purpose of this illustration.
>>>
>>> Paul Spencer
>>>
>>>
>>>
>>>
>>>
>> --
>> ::SammyRulez::
>> http://www.kyub.com/blog/
>> -----------------------------------------------------------------
>> La programmazione è per un terzo interpretazione e per due terzi 
>> ispirazione.
>>  E per un terzo misitificazione
>>
>>
>>
>
>


Disclaimer: This electronic mail and any attachments are confidential and may 
be privileged. If you are not the intended recipient, please notify the sender 
immediately by replying to this email, and destroy all copies of this email and 
any attachments. Thank you.





***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

Reply via email to