You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ashish Raniwala <ar...@gmail.com> on 2005/11/14 02:33:58 UTC
contrib:Table type 3 implementation question
Hi,
I am working with a table with very large data set (several millions). In
this case I do not want to fetch all the records and do the
pagination/sorting at application server.I am using type 3 table component
implementation but it is not clear to me that how do I do pagination and
sorting at database level ? Any suggestions ?
Thanks,
Ashish Raniwala
RE: contrib:Table type 3 implementation question
Posted by Ashish Raniwala <ar...@gmail.com>.
Thanks, your sample helped a lot to resolve the issue. Not sure why it was
behaving like it but I cleaned up lot of code I had e.g. to manage
sessionState etc and it came up just fine.
-----Original Message-----
From: Gunna Satria Hijrah Kusumah [mailto:gna@nwa.iao.co.id]
Sent: Monday, November 14, 2005 5:43 PM
To: Tapestry users
Subject: Re: contrib:Table type 3 implementation question
Hi,
Maybe you can give me your code so i can guess what wrong. But before that,
maybe you want to check out this simple example.
in Java file,
private IBasicTableModel source;
private DetailObject rowObject;
public DetailObject getRowObject() {
return rowObject;
}
public void setRowObject(DetailObject rowObject) {
this.rowObject = rowObject;
}
public List query(int first, int pageSize){
System.out.println("first = "+first+", pageSize =
"+pageSize);
List list = new ArrayList();
for(int i=0;i<getDummyList().size();i++){
if(i>=first && i<(first+pageSize)){
list.add(getDummyList().get(i));
}
}
return list;
}
public List getDummyList(){
List dummyList = new ArrayList();
dummyList.add(new DetailObject("1","one"));
dummyList.add(new DetailObject("2","two"));
dummyList.add(new DetailObject("3","three"));
dummyList.add(new DetailObject("4","four"));
dummyList.add(new DetailObject("5","five"));
dummyList.add(new DetailObject("6","six"));
dummyList.add(new DetailObject("7","seven"));
dummyList.add(new DetailObject("8","eight"));
dummyList.add(new DetailObject("9","nine"));
dummyList.add(new DetailObject("10","ten"));
return dummyList;
}
public IBasicTableModel getSource() {
if(null==source){
source = new IBasicTableModel(){
public int getRowCount() {
return
Home.this.getDummyList().size();//Home is the class name
}
public Iterator getCurrentPageRows(int
nFirst, int nPageSize, ITableColumn objSortColumn, boolean bSortOrder) {
return query(nFirst,
nPageSize).iterator();
}
};
}
return source;
}
in .page file
<component id="table" type="contrib:Table">
<binding name="row" expression="rowObject"/>
<binding name="columns" expression="'value:Value:value,
label:Label:label'"/>
<binding name="source" expression="source"/>
<binding name="pageSize" expression="3"/>
</component>
regards,
Gunna
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: contrib:Table type 3 implementation question
Posted by Gunna Satria Hijrah Kusumah <gn...@nwa.iao.co.id>.
Hi,
Maybe you can give me your code so i can guess what wrong. But before that,
maybe you want to check out this simple example.
in Java file,
private IBasicTableModel source;
private DetailObject rowObject;
public DetailObject getRowObject() {
return rowObject;
}
public void setRowObject(DetailObject rowObject) {
this.rowObject = rowObject;
}
public List query(int first, int pageSize){
System.out.println("first = "+first+", pageSize = "+pageSize);
List list = new ArrayList();
for(int i=0;i<getDummyList().size();i++){
if(i>=first && i<(first+pageSize)){
list.add(getDummyList().get(i));
}
}
return list;
}
public List getDummyList(){
List dummyList = new ArrayList();
dummyList.add(new DetailObject("1","one"));
dummyList.add(new DetailObject("2","two"));
dummyList.add(new DetailObject("3","three"));
dummyList.add(new DetailObject("4","four"));
dummyList.add(new DetailObject("5","five"));
dummyList.add(new DetailObject("6","six"));
dummyList.add(new DetailObject("7","seven"));
dummyList.add(new DetailObject("8","eight"));
dummyList.add(new DetailObject("9","nine"));
dummyList.add(new DetailObject("10","ten"));
return dummyList;
}
public IBasicTableModel getSource() {
if(null==source){
source = new IBasicTableModel(){
public int getRowCount() {
return Home.this.getDummyList().size();//Home is the class name
}
public Iterator getCurrentPageRows(int nFirst, int nPageSize, ITableColumn
objSortColumn, boolean bSortOrder) {
return query(nFirst, nPageSize).iterator();
}
};
}
return source;
}
in .page file
<component id="table" type="contrib:Table">
<binding name="row" expression="rowObject"/>
<binding name="columns" expression="'value:Value:value,
label:Label:label'"/>
<binding name="source" expression="source"/>
<binding name="pageSize" expression="3"/>
</component>
regards,
Gunna
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: contrib:Table type 3 implementation question
Posted by Ashish Raniwala <ar...@gmail.com>.
Hi,
I am using IBasicTableModel in table type 3 implementation.
Currently pagination is not working for me. When I click on << < 1 2 3 > >>
to go to next page, I always get recordIndex 0 in getCurrentPageRows(int
recordIndex, int pageSize, ITableColumn tableColumn, boolean sortOrder)
method of IBasicTableModel. What do I need to do to help TableView call this
method with correct record index ?
Thanks,
Ashish
-----Original Message-----
From: Gunna Satria Hijrah Kusumah [mailto:gna@nwa.iao.co.id]
Sent: Sunday, November 13, 2005 5:42 PM
To: Tapestry users
Subject: Re: contrib:Table type 3 implementation question
Hi,
You may use IBasicTableModel as source for your Table component.
Hope Helps,
regards,
Gunna
On Monday 14 November 2005 08:33, Ashish Raniwala wrote:
> Hi,
> I am working with a table with very large data set (several millions).
> In this case I do not want to fetch all the records and do the
> pagination/sorting at application server.I am using type 3 table
> component implementation but it is not clear to me that how do I do
> pagination and sorting at database level ? Any suggestions ?
> Thanks,
> Ashish Raniwala
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: contrib:Table type 3 implementation question
Posted by Ashish Raniwala <ar...@gmail.com>.
Thanks this surely helped.
-----Original Message-----
From: Gunna Satria Hijrah Kusumah [mailto:gna@nwa.iao.co.id]
Sent: Sunday, November 13, 2005 5:42 PM
To: Tapestry users
Subject: Re: contrib:Table type 3 implementation question
Hi,
You may use IBasicTableModel as source for your Table component.
Hope Helps,
regards,
Gunna
On Monday 14 November 2005 08:33, Ashish Raniwala wrote:
> Hi,
> I am working with a table with very large data set (several millions).
> In this case I do not want to fetch all the records and do the
> pagination/sorting at application server.I am using type 3 table
> component implementation but it is not clear to me that how do I do
> pagination and sorting at database level ? Any suggestions ?
> Thanks,
> Ashish Raniwala
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: contrib:Table type 3 implementation question
Posted by Gunna Satria Hijrah Kusumah <gn...@nwa.iao.co.id>.
Hi,
You may use IBasicTableModel as source for your Table component.
Hope Helps,
regards,
Gunna
On Monday 14 November 2005 08:33, Ashish Raniwala wrote:
> Hi,
> I am working with a table with very large data set (several millions). In
> this case I do not want to fetch all the records and do the
> pagination/sorting at application server.I am using type 3 table component
> implementation but it is not clear to me that how do I do pagination and
> sorting at database level ? Any suggestions ?
> Thanks,
> Ashish Raniwala
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org