Hi Isomorphic,
it seems that ListGrid's text columns are case insensitive when sorting.
From my test, this is true for the sample's HSQLDB as well, at least it seems to be configured this way.
I found out using this BuiltInDS.java (see especially setDataPageSize(5) and setDrawAllMaxCells(0))
and scrolling slowly while watching the DSRequests and their answers go by.
"southern subspecies: Haliaeetus leucocephalus leuc" came before scientificName:"Struthio camelus" and after "Python molurus molurus".
This is not always the case. Oracle for example is case sensitive using the standard AL32UTF8 Character Set.
So by just using a different DB, the content of a sorted ListGrid showing let's say company names (some starting with capital letters, some starting with small letters) is different (as only the first some x sorted entries are transferred to the server).
The suggested enhancement is
a) To introduce a setting telling the framework if the DB is CS or CI (CS sorting is not possible if the system is CI).
b) Introduce a default setting for the framework (e.g. "always sort CI yes/no").
c) Introduce override points at ListGridField-level like setSortCaseInsensitive(Boolean).
As I'm sure this (especially "c") is a pretty big change and ListGrid seems to be always CI by default (when no SortSpecifiers are used) currently (I did not find a CI/CS related setting in the docs), a server.properties setting like alwaysSortCaseInsensitive (point "b") would be useful, that, when activated always adds a LOWER() around the ORDER BY-columns of the generated SQL.
Out of curiosity: Do you re-sort on the client side if you get a sorted (by the requested columns, in requested order, in requested ASC/DESC) DSResponse from the server?
Best regards,
Blama
it seems that ListGrid's text columns are case insensitive when sorting.
From my test, this is true for the sample's HSQLDB as well, at least it seems to be configured this way.
I found out using this BuiltInDS.java (see especially setDataPageSize(5) and setDrawAllMaxCells(0))
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.SortSpecifier; import com.smartgwt.client.types.SortDirection; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private ListGrid boundList; private IButton btn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); boundList = new ListGrid(DataSource.get("animals")); boundList.setWidth(1200); boundList.setHeight(100); boundList.setCanMultiSort(true); boundList.setCanSort(true); boundList.setShowFilterEditor(true); boundList.setAutoFetchData(false); [B] boundList.setDataPageSize(5); boundList.setDrawAllMaxCells(0); [/B] ListGridField commonName = new ListGridField("commonName"); ListGridField scientificName = new ListGridField("scientificName"); ListGridField lifeSpan = new ListGridField("lifeSpan"); lifeSpan.setTitle("Our title"); lifeSpan.setSortByDisplayField(true); ListGridField diet = new ListGridField("diet"); ListGridField information = new ListGridField("information"); boundList.setFields(commonName, scientificName, lifeSpan, diet, information); boundList.setSort(new SortSpecifier("scientificName", SortDirection.ASCENDING)); boundList.fetchData(); btn = new IButton("invalidateCache()"); btn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { boundList.invalidateCache(); } }); VLayout vLayout = new VLayout(10); vLayout.setMembers(boundList, btn); vLayout.draw(); } }
"southern subspecies: Haliaeetus leucocephalus leuc" came before scientificName:"Struthio camelus" and after "Python molurus molurus".
This is not always the case. Oracle for example is case sensitive using the standard AL32UTF8 Character Set.
So by just using a different DB, the content of a sorted ListGrid showing let's say company names (some starting with capital letters, some starting with small letters) is different (as only the first some x sorted entries are transferred to the server).
The suggested enhancement is
a) To introduce a setting telling the framework if the DB is CS or CI (CS sorting is not possible if the system is CI).
b) Introduce a default setting for the framework (e.g. "always sort CI yes/no").
c) Introduce override points at ListGridField-level like setSortCaseInsensitive(Boolean).
As I'm sure this (especially "c") is a pretty big change and ListGrid seems to be always CI by default (when no SortSpecifiers are used) currently (I did not find a CI/CS related setting in the docs), a server.properties setting like alwaysSortCaseInsensitive (point "b") would be useful, that, when activated always adds a LOWER() around the ORDER BY-columns of the generated SQL.
Out of curiosity: Do you re-sort on the client side if you get a sorted (by the requested columns, in requested order, in requested ASC/DESC) DSResponse from the server?
Best regards,
Blama
Comment