| Issue 13: | How easy it is to change the 3 states sort into 2 state sort? | |
| 2 people starred this issue and may be notified of changes. | Back to list |
I would like to change the 3 states sort click into 2 states click and have the clear on the arrow click. Is it hard to customize it, or it is possible for you to add a property to the property file to configure the sort states? Thanks Nad
Apr 30, 2007
#1
extremec...@gmail.com
Status:
Accepted
May 1, 2007
Thank you for the quick response, I took your advice and I set the
defaultSortOrderable to false and added removeAllSortsFromLimit(id); to
removeAllFiltersFromLimit(id) function.
I had to change one thing:
column.getHeaderRenderer().setDefaultSortOrderable(false);
to
((HtmlHeaderRenderer)column.getHeaderRenderer()).setDefaultSortOrderable(false);
to make it work.
I was a little bit adventurer and I replaced the arrow image with input image with
onClick I added "removeSortFromLimit(id,property);onInvokeAction(id)" in the
HtmlHeaderRendererImpl class.
The code change I made from:
html.img();
html.src(imagesPath + getCoreContext().getPreference
(HtmlConstants.SORT_ASC_IMAGE));
html.style("border:0");
html.alt("Arrow");
html.end();
to
html.input().type("IMAGE");
html.src(imagesPath + getCoreContext().getPreference
(HtmlConstants.SORT_ASC_IMAGE));
html.onclick("removeSortFromLimit('" + limit.getId() + "','" +
column.getProperty() + "');onInvokeAction('" + limit.getId() + "')");
html.close();
and the same for DESC
To my surprise I got NumberFormatException error. What happen is when
removeSortFromLimit(id,property) get invoked in the input image tag, the hidden page
number get posted twice, and the class LimitActionFactoryImpl.getPage() tries to
format an object array and fails with NumberFormatException error. I don't
understand why removeSortFromLimit(id,property) works fine when invoked from the td
tag.
Any way thanks for your help.
Nad
May 1, 2007
You shouldn't need to cast though. I am using the Java 1.5 feature of returning a
specific return type for different view implementations. For example this is what I
do when using the html view. This would work regardless of the factory you use.
HtmlComponentFactory factory = new HtmlComponentFactory(webContext, coreContext);
HtmlColumn firstName = factory.createColumn("name.firstName", customEditor);
firstName.getHeaderRenderer().setDefaultSortOrderable(false);
Not sure about the other things you tried...I'd have to try it myself.
May 2, 2007
It work only if getting the column return HtmlColumn; and this what I used:
HtmlTableFactory tableFactory = new HtmlTableFactory(webContext, coreContext);
HtmlTable table = tableFactory.createTable("X", "name", "nickname", "term");
Column firstName = table.getRow().getColumn("name");
((HtmlHeaderRenderer)firstName.getHeaderRenderer()).setDefaultSortOrderable(false);
If table.getRow().getColumn(...) returns an HtmlColumn then I would not have to cast.
May 2, 2007
I will check into this then. It would be preferred if developers would not have to cast anything.
May 2, 2007
I have this checked into the head stream so it will appear in the next release. I will be doing another release in the next couple weeks with the start of the extra Groovy hooks so you can refactor your code then.
May 2, 2007
I guess I was pretty vague on my last post...the HtmlRow now returns a HtmlColumn when doing a row.getColumn()!
May 3, 2007
Thanks
Oct 25, 2007
Will close and open as a separate issue with the correct naming.
Status:
Fixed
|