Dyanamic PageLink in Table

5 Messages Forum Options Options
Embed this topic
Permalink
mravister
Dyanamic PageLink in Table
Reply Threaded MoreMore options
Print post
Permalink
Hi Everyone, I am begginer to Click framework.Below is the code that I use in OnInit() method, where I am getting 'companyNames' from database table and adding pageLink in every row to navigate to other page class.I have declared pageLink like this: PageLink tmpCompanyNameLink = new PageLink(EditReportPage.class); List companiesList = (new CompanyDetails()).getAllCompanies(); List> tableData= new ArrayList>(); if (companiesList != null) { for (Iterator iterator = companiesList.iterator(); iterator.hasNext();) { Map tableRowData = new HashMap(); Company company = iterator.next(); String tmpComanyName = company.getCompanyName(); tmpCompanyNameLink.setName(tmpComanyName); tmpCompanyNameLink.setLabel(tmpComanyName); tmpCompanyNameLink.setListener(this, "OnCompanyClick"); tmpCompanyNameLink.setContext(context); tmpCompanyNameLink.setTitle("Company Name"); tmpCompanyNameLink.setStyle("color", "black"); tmpCompanyNameLink.setParameter("id",company.getId().toString()); tableRowData.put(COMPANY_HEADER, tmpCompanyNameLink.toString()); tableData.add(tableRowData); } table.setRowList(tableData); } Problem : The Company Column is not getting sorted properly with inbuilt column comparator.They are not sorted alphabetically either ascending or descending on company column sort click.Please provide me the solution for this. Thanks, Rav
sabob
Re: Dyanamic PageLink in Table
Reply Threaded MoreMore options
Print post
Permalink
Hi,

Columns are sorted based on their values. If the column contains a non
comparator object it will converted to a String -> object.toString().

In your case you add a PageLink (which does not implement
java.util.Comparator) to the Column. When the data is sorted the
PageLink is converted to a String:

"<a href="..." id="123" name="..">West Bank</a>"

It is this String value that is sorted, not "West Bank" as you would want.

A simple solution is create a separate column for the company name
which can be sorted. The second column can contain the PageLink with
its label set to "edit" for example.

kind regards

bob

PS: I notice that you set the PageLink listener. PageLink only links
to Pages and won't invoke a specific listener. In fact PageLink
Javadoc states that calling setListener does nothing.


mravister wrote:

> Hi Everyone, I am begginer to Click framework.Below is the code that I
> use in OnInit() method, where I am getting 'companyNames' from database
> table and adding pageLink in every row to navigate to other page class.I
> have declared pageLink like this: PageLink tmpCompanyNameLink = new
> PageLink(EditReportPage.class); List companiesList = (new
> CompanyDetails()).getAllCompanies(); List> tableData= new ArrayList>();
> if (companiesList != null) { for (Iterator iterator =
> companiesList.iterator(); iterator.hasNext();) { Map tableRowData = new
> HashMap(); Company company = iterator.next(); String tmpComanyName =
> company.getCompanyName(); tmpCompanyNameLink.setName(tmpComanyName);
> tmpCompanyNameLink.setLabel(tmpComanyName);
> tmpCompanyNameLink.setListener(this, "OnCompanyClick");
> tmpCompanyNameLink.setContext(context);
> tmpCompanyNameLink.setTitle("Company Name");
> tmpCompanyNameLink.setStyle("color", "black");
> tmpCompanyNameLink.setParameter("id",company.getId().toString());
> tableRowData.put(COMPANY_HEADER, tmpCompanyNameLink.toString());
> tableData.add(tableRowData); } table.setRowList(tableData); } Problem :
> The Company Column is not getting sorted properly with inbuilt column
> comparator.They are not sorted alphabetically either ascending or
> descending on company column sort click.Please provide me the solution
> for this. Thanks, Rav
> ------------------------------------------------------------------------
> View this message in context: Dyanamic PageLink in Table
> <http://www.nabble.com/Dyanamic-PageLink-in-Table-tp19161310p19161310.html>
> Sent from the click-user mailing list archive
> <http://www.nabble.com/click-user-f3305.html> at Nabble.com.
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Click-user mailing list
> Click-user@...
> https://lists.sourceforge.net/lists/listinfo/click-user


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user
mravister
Re: Dyanamic PageLink in Table
Reply Threaded MoreMore options
Print post
Permalink
Thanks, Bob.I have understood about Pagelink sorting in table.I will follow the way as you said.

Thanks,

Ravi

sabob wrote:
Hi,

Columns are sorted based on their values. If the column contains a non
comparator object it will converted to a String -> object.toString().

In your case you add a PageLink (which does not implement
java.util.Comparator) to the Column. When the data is sorted the
PageLink is converted to a String:

"West Bank"

It is this String value that is sorted, not "West Bank" as you would want.

A simple solution is create a separate column for the company name
which can be sorted. The second column can contain the PageLink with
its label set to "edit" for example.

kind regards

bob

PS: I notice that you set the PageLink listener. PageLink only links
to Pages and won't invoke a specific listener. In fact PageLink
Javadoc states that calling setListener does nothing.


mravister wrote:
> Hi Everyone, I am begginer to Click framework.Below is the code that I
> use in OnInit() method, where I am getting 'companyNames' from database
> table and adding pageLink in every row to navigate to other page class.I
> have declared pageLink like this: PageLink tmpCompanyNameLink = new
> PageLink(EditReportPage.class); List companiesList = (new
> CompanyDetails()).getAllCompanies(); List> tableData= new ArrayList>();
> if (companiesList != null) { for (Iterator iterator =
> companiesList.iterator(); iterator.hasNext();) { Map tableRowData = new
> HashMap(); Company company = iterator.next(); String tmpComanyName =
> company.getCompanyName(); tmpCompanyNameLink.setName(tmpComanyName);
> tmpCompanyNameLink.setLabel(tmpComanyName);
> tmpCompanyNameLink.setListener(this, "OnCompanyClick");
> tmpCompanyNameLink.setContext(context);
> tmpCompanyNameLink.setTitle("Company Name");
> tmpCompanyNameLink.setStyle("color", "black");
> tmpCompanyNameLink.setParameter("id",company.getId().toString());
> tableRowData.put(COMPANY_HEADER, tmpCompanyNameLink.toString());
> tableData.add(tableRowData); } table.setRowList(tableData); } Problem :
> The Company Column is not getting sorted properly with inbuilt column
> comparator.They are not sorted alphabetically either ascending or
> descending on company column sort click.Please provide me the solution
> for this. Thanks, Rav
> ------------------------------------------------------------------------
> View this message in context: Dyanamic PageLink in Table
> <http://www.nabble.com/Dyanamic-PageLink-in-Table-tp19161310p19161310.html>
> Sent from the click-user mailing list archive
> <http://www.nabble.com/click-user-f3305.html> at Nabble.com.
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Click-user mailing list
> Click-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/click-user


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/click-user
Hans Poo-2
Gray out the disabled row
Reply Threaded MoreMore options
Print post
Permalink
Hi,

First, i've been using click since February and it's amazing, many thanks
Malcom, Bob and Team.

I have a table of user accounts. Some users are disabled and i would like to
show grayed the entire row for them.

I'was thinking in using a decorator at least in one row. In this decorator i
could get to the table row "tr" to set the class or id, to something to catch
latter with some css selector.

¿ How to get to the row attributes ?

The looking at the code at "renderBodyRows", i realized that it's not supported.

Can you give some clues ?

I don't want to render the table manually.

Thanks
Hans

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user
sabob
Re: Gray out the disabled row
Reply Threaded MoreMore options
Print post
Permalink
Hi Hans,

Click doesn't provide ability to add row attributes. Perhaps we can
expose a way through a hook in the Table:

public void setRowAttributes(Map attributes, Object row, int rowIndex){
}

Can you open a JIRA for this? http://www.avoka.com/jira/

kind regards

bob


hans wrote:

> Hi,
>
> First, i've been using click since February and it's amazing, many thanks
> Malcom, Bob and Team.
>
> I have a table of user accounts. Some users are disabled and i would like to
> show grayed the entire row for them.
>
> I'was thinking in using a decorator at least in one row. In this decorator i
> could get to the table row "tr" to set the class or id, to something to catch
> latter with some css selector.
>
> ¿ How to get to the row attributes ?
>
> The looking at the code at "renderBodyRows", i realized that it's not supported.
>
> Can you give some clues ?
>
> I don't want to render the table manually.
>
> Thanks
> Hans
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Click-user mailing list
> Click-user@...
> https://lists.sourceforge.net/lists/listinfo/click-user


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user