Re: Grid component and available rows number

2008-10-14 Thread Renat Zubairov
Hello

You may have a look on the implementation of the GridDataSource for Hibernate

http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateGridDataSource.java?view=markup

BR
Renat

2008/10/14 shymon [EMAIL PROTECTED]:


 I wanted to use a grid component to display search results. So I tried to
 define a class which implements GridDataSource interface. Unfortunatelly
 getAvailableRecords() method is called by T5 before prepare(...) method.
 This doesn't suit me as I receive total record number with search results
 only.

 My search engine is accessed through XML-RPC and has a Query(...) method
 which performs the search. This method returns a dictionary (or hashtable)
 containing search results and some other info including total number of
 records matching given query.

 Of course I can trigger Query(...) method from getAvailableRecords() or even
 before, but I don't have information about indexFrom, indexTo and
 sortConstraints and don't want to send all records (without limit) through
 XML-RPC.

 Is there any reasonable solution or do I have to write my own grid
 component?
 --
 View this message in context: 
 http://www.nabble.com/Grid-component-and-available-rows-number-tp19964529p19964529.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
Best regards,
Renat Zubairov

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Grid component and available rows number

2008-10-14 Thread shymon



Renat Zubairov wrote:
 
 Hello
 
 You may have a look on the implementation of the GridDataSource for
 Hibernate
 
 http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateGridDataSource.java?view=markup
 
 BR
 Renat
 
 

Not very helpful. I don't know Hibernate but as I understand there are two
methods used in this impl. of GridDataSource: 

Integer result = (Integer) criteria.uniqueResult(); - which returns
number of rows

and 

 preparedResults = crit.list(); - which do the actual query.

As I mentioned in my first post, search engine which I use doesn't have
suchmethods. The only one I have is Query({query_params}) which returns
given portion of results and the total number of results.

I can perform Query in getAvailableRows(), but then I would have to send ALL
results through XML-RPC and limit them in prepare method - I don't think
it's a good idea...

regards,
Shymon
-- 
View this message in context: 
http://www.nabble.com/Grid-component-and-available-rows-number-tp19964529p19968644.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Grid component and available rows number

2008-10-14 Thread Andy Huhn
Hi Shymon,

If you don't want the pager to show up at all on the grid component, you
can set

  pagerPosition=none

on the grid.  This might prevent the row count from being generated at
all.

Andy

On Tue, 2008-10-14 at 00:50 -0700, shymon wrote:
 
 
 Renat Zubairov wrote:
  
  Hello
  
  You may have a look on the implementation of the GridDataSource for
  Hibernate
  
  http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateGridDataSource.java?view=markup
  
  BR
  Renat
  
  
 
 Not very helpful. I don't know Hibernate but as I understand there are two
 methods used in this impl. of GridDataSource: 
 
 Integer result = (Integer) criteria.uniqueResult(); - which returns
 number of rows
 
 and 
 
  preparedResults = crit.list(); - which do the actual query.
 
 As I mentioned in my first post, search engine which I use doesn't have
 suchmethods. The only one I have is Query({query_params}) which returns
 given portion of results and the total number of results.
 
 I can perform Query in getAvailableRows(), but then I would have to send ALL
 results through XML-RPC and limit them in prepare method - I don't think
 it's a good idea...
 
 regards,
 Shymon



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Grid component and available rows number

2008-10-14 Thread Andy Huhn
Hi Shymon,

The way I handle this is this:

I use a DAO that I wrote as the source for my Grid.

In a @BeginRender method on the page, I initialize the criteria in the
DAO.

Then, when the Grid calls prepare(), the DAO retrieves all matching rows
from Hibernate (you could retrieve from XML-RPC), and the DAO stores
that result set internally in the DAO.  (Only the rows that match the
criteria are returned).

When the Grid calls getAllAVailableRows(), the DAO returns the count of
rows in that result set.

When the Grid calls GetRowValue(), I return one specific row from that
result set.

Andy

On Tue, 2008-10-14 at 01:52 -0700, shymon wrote:
 
 
 Andy Huhn-3 wrote:
  
  Hi Shymon,
  
  If you don't want the pager to show up at all on the grid component, you
  can set
  
pagerPosition=none
  
  on the grid.  This might prevent the row count from being generated at
  all.
  
  Andy
  
  
 
 
 Uhmmm... you are kidding, right? :)
 Dou you think I should display all results on one page? :)
 Of course I need a pager.
 
 Maybe I could use Grid component w/o pager and create my own one, but id
 doesn't make much sense for me. Pager is 50% of why I want to use grid. :)
 
 Shymon
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Grid component and available rows number

2008-10-14 Thread shymon



Andy Huhn-3 wrote:
 
 Hi Shymon,
 
 If you don't want the pager to show up at all on the grid component, you
 can set
 
   pagerPosition=none
 
 on the grid.  This might prevent the row count from being generated at
 all.
 
 Andy
 
 


Uhmmm... you are kidding, right? :)
Dou you think I should display all results on one page? :)
Of course I need a pager.

Maybe I could use Grid component w/o pager and create my own one, but id
doesn't make much sense for me. Pager is 50% of why I want to use grid. :)

Shymon

-- 
View this message in context: 
http://www.nabble.com/Grid-component-and-available-rows-number-tp19964529p19969457.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Grid component and available rows number

2008-10-14 Thread Thiago H. de Paula Figueiredo
Em Tue, 14 Oct 2008 04:50:50 -0300, shymon [EMAIL PROTECTED]  
escreveu:



As I mentioned in my first post, search engine which I use doesn't have
suchmethods. The only one I have is Query({query_params}) which returns
given portion of results and the total number of results.

I can perform Query in getAvailableRows(), but then I would have to send  
ALL results through XML-RPC and limit them in prepare method - I don't  
think

it's a good idea...


It is really not a good idea, but you have no other choice here, as your  
search implementation (accessed through XML-RPC) does not support paged  
queries. Therefore, implementing GridDataSource gives no advantage over  
passing a List directly to Grid. At least you have the paged listing  
interface. ;)


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Grid component and available rows number

2008-10-13 Thread shymon


I wanted to use a grid component to display search results. So I tried to
define a class which implements GridDataSource interface. Unfortunatelly
getAvailableRecords() method is called by T5 before prepare(...) method.
This doesn't suit me as I receive total record number with search results
only.

My search engine is accessed through XML-RPC and has a Query(...) method
which performs the search. This method returns a dictionary (or hashtable)
containing search results and some other info including total number of
records matching given query.

Of course I can trigger Query(...) method from getAvailableRecords() or even
before, but I don't have information about indexFrom, indexTo and
sortConstraints and don't want to send all records (without limit) through
XML-RPC.

Is there any reasonable solution or do I have to write my own grid
component?
-- 
View this message in context: 
http://www.nabble.com/Grid-component-and-available-rows-number-tp19964529p19964529.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]