Insensitive Sort in DataGrid
Hi All,
Is there a property that can be set to provide for a
case-insensitive sort? or do I need to create a custom sort compare
function?
Thanks,
Tom
I imagine the datagrid is resetting when you reassign its dataProvider.
If you use a single instance of XMLListCollection as the dataProvider
for the grid and assign your XML data to the XMLListCollection's
'source' property, your data will update without the grid resetting.
Here's a very simple example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="setDataProvider()">
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
[Bindable]
private var xmlOriginal : XML =
<root>
<item name="Alpha" letter="Z"/>
<item name="Beta" letter="P"/>
<item name="Gamma" letter="X"/>
<item name="Delta" letter="P"/>
</root>
private var xmlUpdated : XML =
<root>
<item name="Alpha" letter="F"/>
<item name="Beta" letter="U"/>
<item name="Gamma" letter="A"/>
<item name="Delta" letter="P"/>
<item name="Epsilon" letter="F"/>
</root>
private function setDataProvider() : void
dataGrid.dataProvider = new XMLListCollection( xmlOriginal..item );
]]>
</mx:Script>
<mx:DataGrid
id="dataGrid"/>
<mx:Button
label="Simulate Update"
click="XMLListCollection( dataGrid.dataProvider ).source = xmlUpdated..item"/>
</mx:Application>
Similar Messages
-
How to make a sortable column in a table to do a case insensitive sort ?
Hi :
I am using Jdeveloper Studio Edition Version 11.1.1.1.0 and my table columns are sortable but i want to make sure that it case insensitive sort ,for example if i have following column values :
abc,def,ABC,ghi
Sorted results should not be likes this : abc,def,ghi,ABC
instead of this it should be like this : abc,ABC,def,ghi
Please let me know more about it.
Thanks
ANDear,
I'm using the same configuration, Could u tell me how did u done the sort in a column in any case.
Regards,
RengarajR
Edited by: Rengaraj Rengasamy on Oct 19, 2009 1:34 AM -
ADF table: case-insensitive sorting
I have an <af:table> that uses a SortableModel as it's data source. I have sorting enabled on the table, but it's sorted according to case sensitivity.
My data source has mixed case, and I'd like to be able to sort regardless of case. Is there anyway to change the behavior so it does a case-insensitive sort instead?
ThanksIn case anyone else is looking for this, I went ahead and wrote an extension of CollectionModel that performs a case insensitive sort on String objects. I'm posting it here in the hopes it will help others in the same jam I was. It would really have been helpful if Oracle had made the source code to SortableModel available. I hope I did things properly with the rowKey stuff since there are no examples to work from.
Anyway, here it is:
package com.fhm.mwb.ui.model;
import oracle.adf.view.faces.model.CollectionModel;
import oracle.adf.view.faces.model.SortCriterion;
import org.apache.commons.beanutils.BeanComparator;
import org.apache.commons.collections.comparators.ComparableComparator;
import org.apache.commons.collections.comparators.ComparatorChain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.faces.FacesException;
import javax.faces.model.DataModelEvent;
import javax.faces.model.DataModelListener;
* This class provides a sortable data model that uses case insensitive sort order when processing
* String objects. All other objects in the data must implement Comparable and are sorted using
* Comparable.compare().
public class CaseInsensitiveSortableModel extends CollectionModel {
private static BasicComparator _comparator = new BasicComparator();
* Default constructor.
public CaseInsensitiveSortableModel() {
* Construct on top of a list of data.
* @param list List of data to wrap in the model
public CaseInsensitiveSortableModel(List list) {
setWrappedData(list);
* Set the sort criteria for this model
* @param criteria List of SortCriterion objects
public void setSortCriteria(List criteria) {
_sortCriteria = criteria;
if((criteria != null) && (criteria.size() > 0)) {
// Sort our model data using this new criteria
ComparatorChain chain = new ComparatorChain();
for(int i = 0; i < criteria.size(); i++) {
SortCriterion crit = (SortCriterion) criteria.get(i);
chain.addComparator(new BeanComparator(crit.getProperty(), _comparator),
!crit.isAscending());
List list = (List) getWrappedData();
Collections.sort(list, chain);
setWrappedData(list);
} else {
// Clear out our sort order
_sortCriteria = new ArrayList();
* Get the current sort criteria.
* @return List of sort criteria
public List getSortCriteria() {
return _sortCriteria;
* Determine if a given column is sortable.
* @param column Name of the column to test
* @return boolean true if the column is sortable
public boolean isSortable(String column) {
return true; // Everything is sortable for now
* Sets up a value at a particular rowKey to be the current value. The current value
* is returned by calling {@link #getRowData}.
* @param rowKey the rowKey of the value to make current. Use null to clear the current value.
public void setRowKey(String rowKey) {
if(rowKey == null) {
setRowIndex(-1);
} else {
setRowIndex(Integer.valueOf(rowKey).intValue());
* Gets the rowKey of the current value. The current value is returned by
* calling {@link #getRowData}.
* @return the rowKey of the current value, or null if there is no current value
public String getRowKey() {
return isRowAvailable() ? String.valueOf(_rowIndex) : null;
* Set the list data we are wrapping
* @throws ClassCastException if data is
* non-null and is not a List
public void setWrappedData(Object data) {
_wrappedList = (List) data;
if(_wrappedList == null) {
setRowIndex(-1);
* Return the object representing the data wrapped by this model, if any.
public Object getWrappedData() {
return _wrappedList;
* Return true if there is wrappedData
* available, and the current value of rowIndex is greater
* than or equal to zero, and less than the size of the list. Otherwise,
* return false.
* @exception FacesException if an error occurs getting the row availability
public boolean isRowAvailable() {
return ((_rowIndex < 0) || (_rowIndex > getRowCount())) ? false : true;
* If there is wrappedData available, return the
* length of the list. If no wrappedData is available,
* return -1.
* @exception FacesException if an error occurs getting the row count
public int getRowCount() {
return (_wrappedList == null) ? (-1) : _wrappedList.size();
* If row data is available, return the list element at the index
* specified by rowIndex. If no wrapped data is available,
* return null.
* @exception IllegalArgumentException if now row data is available
* at the currently specified row index
public Object getRowData() {
if(_wrappedList == null) {
return null;
} else if(!isRowAvailable()) {
throw new IllegalArgumentException("No row data available");
} else {
return wrappedList.get(rowIndex);
* Return the zero-relative index of the currently selected row. If
* we are not currently positioned on a row, or no wrappedData
* is available, return -1.
* @exception FacesException if an error occurs getting the row index
public int getRowIndex() {
return _rowIndex;
* Set the zero-relative index of the currently selected row, or -1
* to indicate that we are not positioned on a row. It is
* possible to set the row index at a value for which the underlying data
* collection does not contain any row data. Therefore, callers may
* use the isRowAvailable() method to detect whether row data
* will be available for use by the getRowData() method.
* If there is no wrappedData available when this method
* is called, the specified rowIndex is stored (and may be
* retrieved by a subsequent call to getRowData()), but no
* event is sent. Otherwise, if the currently selected row index is
* changed by this call, a {@link DataModelEvent} will be sent to the
* rowSelected() method of all registered
* {@link DataModelListener}s.
* @param rowIndex The new zero-relative index (must be non-negative)
* @exception FacesException if an error occurs setting the row index
* @exception IllegalArgumentException if rowIndex
* is less than -1
public void setRowIndex(int rowIndex) {
if(rowIndex < -1) {
throw new IllegalArgumentException("Row index must be >= 0");
int old = _rowIndex;
_rowIndex = rowIndex;
if(_wrappedList == null) {
return;
DataModelListener[] listeners = getDataModelListeners();
if((old != _rowIndex) && (listeners != null)) {
Object rowData = null;
if(isRowAvailable()) {
rowData = getRowData();
DataModelEvent event = new DataModelEvent(this, _rowIndex, rowData);
int n = listeners.length;
for(int j = 0; j < n; j++) {
if(null != listeners[j]) {
listeners[j].rowSelected(event);
private List _wrappedList = new ArrayList();
private List _sortCriteria = new ArrayList();
private int _rowIndex = -1;
* Internal class to provide a general Comparator that treats Strings in a case
* insensitive manner. All other types are assumed to be instances of Comparable
* and handled as such.
private static class BasicComparator implements Comparator, Serializable {
private static final Comparator INSENSITIVE_COMPARATOR = String.CASE_INSENSITIVE_ORDER;
private static final Comparator NORMAL_COMPARATOR = ComparableComparator.getInstance();
public BasicComparator() {
public int compare(Object o1, Object o2) {
if(o1 instanceof String && o2 instanceof String) {
return INSENSITIVE_COMPARATOR.compare(o1, o2);
} else {
return NORMAL_COMPARATOR.compare(o1, o2);
} -
Customized sorting in datagrid
I've just started to look at flex, could be a really simple
answer to this... Newbie warning!
Let's say that I want to sort a datagrid by a column called
'priority'. The values of 'priority' can be Low, Normal and High.
Obviously I want rows with 'High' priority to be sorted first, then
'Normal' and then 'Low'. How do I do that?create a sort function like this:
package controls.sorters {
// import flash.util.trace;
public class Sorter {
private var priorityLU:Object={Low:0,Normal:1,High:2};
public function Sorter(){
public function sortPriority(obj1:Object, obj2:Object,
col:Array = null):Number{
if (priorityLU[obj1["priority"]] >
priorityLU[obj2["priority"]]){
return -1;
}else if(priorityLU[obj2["priority"]] ==
priorityLU[obj1["priority"]] ){
return 0;
}else{
return 1;
this is then used like:
<ns1:Sorter id="mySorter" />
<mx:DataGridColumn id="priorityCol" width="100"
headerText="Priority" dataField="priority"
sortCompareFunction="mySorter.sortPriority"/> -
LC_COLLATE with dotfiles at top, then case-insensitive sorting
Hello,
I would like to have the following sort order in file managers or when using the "ls" command:
1. dotfiles should be on top
2. other files should follow but case-insensitive
For (1) LC_COLLATE=C works, but it then sorts the remaining file case-sensitive
For (2) e.g. LC_COLLATE="en_US.UTF-8" or de_DE.UTF-8 works.
Is there a locale that fits to my needs? If not, is it possible to edit a locale or create custom rules?
Thank you!Y = Opportunity Revenue
X = Month
The report is a 4-month forecast, but not using built-in Forecasting that CRMOD uses; this report uses the Forecast checkbox in an opportunity to determine if the oppty should be on the forecast report, then grabs the overall Oppty Revenue from that same region of the Oppty (not using line/Product level revenue field).
The report uses a table and above that a chart with 3D cylindrical output where each press model (derived from a field in the Oppty header) is a different color (I'm letting Analysis defaults set the colors for each product).
My boss wants to sort the colors from smallest model size to largest model size for consistency sake and to make the chart easier to comprehend with a glance.
Is this even possible? I could see sorting by revenue size, but that's not always the best indicator (as some used larger presses may sell for less than new smaller ones).
Any ideas?
Thanks,
Andy -
Sorting a DataGrid without changing the content
I have a datagrid which is shown in a chart. I'd like to have it sorted upside down the dataField "x" without changing the chart, which is bound to the same arrayCollection. How can I do this without changing the chart?
<mx:DataGrid sortableColumns="false" width="480" height="156" dataProvider="{myArrayCollection}" editable="false" y="581" enabled="true" x="10">
<mx:columns>
<mx:DataGridColumn id="col1" dataField="x" headerText="Trade #" />
<mx:DataGridColumn id="col2" dataField="p" headerText="Price" />
<mx:DataGridColumn id="col3" dataField="n" headerText="Users" />
</mx:columns>
</mx:DataGrid>
thanks
nicolasArrayCollection is a view of a source Array. If you create a second view, it can have a different sort order because sort and filters are properties of a view.
Just assigning AC2 = AC1 simply has AC2 referencing the same view so sorting will have an effect on all consumers of that view. However, if you do:
AC2 = new ArrayCollection();
AC2.list = AC1.list
then you can sort AC2 and AC1 will not reflect the sort and vice-versa. But, if you add an item to AC2 or AC1 it will be reflected in the other AC. If you modify a property of an item in one AC, the other AC will see it.
If you do:
AC2 = new ArrayCollection()
AC2.source = AC1.source
You can also sort AC2 and AC1 will not reflect the sort and vice-versa. But, if you add an item to AC2 or AC1, the other will not reflect that change unless you force an update on the other. Same is true if you modify a property on an item in the AC. The other AC won't know about it until you force an update.
If you want to modify properties of an item in one AC and not every have it reflected in the other AC, then you should do a copy as the previous responder suggested. I believe you want to use the pattern that assings AC2.list = AC1.list.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Custom Sort (by date) in a DataGrid component
So I've got a data grid component hooked up to a data provider like so:
var weekData:XML=// some xml loaded in earlier....
var weekGrid:DataGrid=new DataGrid();
var dataProvider:DataProvider=new DataProvider();
for each(var entry:XML in weekData){
dp.addItem({event:entry.title,date:FormatDate.format(new Date(entry.@startDate),5),data:entry.@startDate});
The title column is just what you might think. The date colum is actually a format like May 2012 or Feb 2013. And the data "column" isn't actually shown in the dataGrid it is the "key" for sorting by date. It contains the getTime() value of the date like 1328515200000. So that will make date sorting just a case of Array.NUMERIC with the appropriate Array.DESCENDING when needed.
I've found that if I do this:
weekGrid.dataProvider.sortOn("data",Array.NUMERIC)
weekGrid.invalidate();
it works and the grid is sorted -- IF I have some other button to click to cause that code to run.
I want to tie it together with the click event on the grid header. Thusly:
weekGrid.addEventListener(DataGridEvent.HEADER_RELEASE,sortDataGrid);
And I've getting the event and all, but evidently that is fireing off the built-in sorting which happens after mine. And it doesn't do what I want.
Any idea how to stop that and allow my perferred sorting to take place?if you don't want the user to sort your datagrid, use:
weekGrid.sortableColumns = false;
and execute your sort without clicking anything. or use:
weekGrid.addEventListener(DataGridEvent.HEADER_RELEASE,sortDataGrid);
function sortDataGrid(e:DataGridEvent):void{
setTimeout(sortF,100);
function sortF():void{
weekGrid.dataProvider.sortOn("data",Array.NUMERIC) -
Keep sorting and sort arrows after datagrid dbprovider changed
I followed this tutorial http://justinjmoses.wordpress.com/2008/06/26/flex-keeping-the-sort-on-a-datagrid-when-you- change-the-dataprovider/
created listeners
that keeps old sorting of datagrid after dataprovider changed, but displaying sort arrow on the wrong column(always the 1st column), how do I fix it?
//constructor
public function FilterDatagrid()
super();
addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE, onDataGridDataChange, false, 0, true);
private var currentSort:mx.collections.Sort;
private function onDataGridDataChange(evt:CollectionEvent):void
//get the new data collection
var ac:ArrayCollection = this.dataProvider as ArrayCollection;
//attach the collection change event
ac.addEventListener(CollectionEvent.COLLECTION_CHANGE, onCollectionChanged,false,0,true);
//if a sort was in place before the data was changed, make sure you apply the sort to this new data
if (currentSort != null)
ac.sort = currentSort;
ac.refresh();
private function onCollectionChanged(evt:CollectionEvent):void
if (evt.kind == CollectionEventKind.REFRESH)
var ac:ArrayCollection = evt.currentTarget as ArrayCollection;
currentSort = ac.sort;the datagrid uses XML as dataprovider and uses labelFunction and sortCompareFunction on each column, not sure if it matters
-
Hello,
I have a problem when it comes to sorting a datagrid with multiple fields. I have two fields A and B . B has numerical values . How can i sort B yet also change the data in A since they are dependent from each other?
This is my datagrid
<s:DataGrid id="rankinggrid" includeIn="Ranking" x="156" y="84" width="528" height="229"
dataProvider="{gridrank}" requestedRowCount="4">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="sequrank" headerText="Sequence" sortDescending="true"></s:GridColumn>
<s:GridColumn dataField="coeff" headerText="Coeffiecent"></s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
Basically i want to sort coeff in desending order but i want to data in seqrank to move accordingly.
Thanks for your help
P.s i am managing to populate the datagrid so all i need is to sort it thanksThanks for your help again
I have reduced the code since the original code is very lengthy and hence impossible to post , yet this should work.
Here i am sorting the grid array according to cost. The problem is that it doesnt work it out in a descending manner(the command you told me doesnt work it gives me an error ) i have used sort and it sorts it in an ascending way and does not give me an error
I would like to solve in a descending way Hope you can help thanks for your time i really appreciate
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="init()"
width="800" height="600">
<fx:Declarations>
<s:ArrayCollection id="ProcessAdder">
<fx:Object ProcessName ="Milling" Cost ="240" Service_Rate="14" />
<fx:Object ProcessName ="Lathe" Cost ="975" Service_Rate="9" />
<fx:Object ProcessName ="Boring" Cost ="800" Service_Rate="8" />
<fx:Object ProcessName ="Drilling" Cost ="270" Service_Rate="20" />
</s:ArrayCollection>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.*;
import mx.collections.ArrayCollection;
import mx.collections.Sort;
import mx.collections.SortField;
public function init(){
var mySort:Sort = new Sort();
// Set the sort field; sort on the last name first, first name second.
var sortfieldRank:SortField = new SortField("Cost", Sort); //descendingSort
mySort.fields = [sortfieldRank];
// Apply the sort to the collection.
//gridrank.sort = mySort;
ProcessAdder.sort = mySort;
ProcessAdder.refresh();
]]>
</fx:Script>
<mx:Legend dataProvider="{ProcessAdder}"/>
<mx:DataGrid id="ProssGrid" x="22" y="334" width="715" dataProvider="{ProcessAdder}"
>
<mx:columns>
<mx:DataGridColumn dataField="ProcessName" headerText="Process Name"/>
<mx:DataGridColumn dataField="Cost" headerText="Cost"/>
<mx:DataGridColumn dataField="Service_Rate" headerText="Service Rate"/>
</mx:columns>
</mx:DataGrid>
</s:WindowedApplication> -
DataGrid Sorting Issue with Hotfix2
I already opened a ticket with Adobe on this, but since this
is a critical issue for us I wanted to post a message to see if
anyone has any idea where the issue in flex sdk lies.
Check tab 2 of the sample app, Sorting a datagrid who's
column only has partial data causes an error, works fine on Hotfix
1 (same test)
Sample App:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="creationComplete()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.utils.ObjectProxy;
[Bindable]
public var dgData:ArrayCollection = new ArrayCollection();
public function creationComplete():void
var object:ObjectProxy;
object = new ObjectProxy();
object["filled"] = "Filled A";
object["partial"] = "Partial A";
dgData.addItem(object);
object = new ObjectProxy();
object["filled"] = "Filled B";
object["partial"] = "Partial B";
dgData.addItem(object);
object = new ObjectProxy();
object["filled"] = "Filled C";
dgData.addItem(object);
object = new ObjectProxy();
object["filled"] = "Filled D";
dgData.addItem(object);
]]>
</mx:Script>
<mx:XMLList id="treeData">
<node label="Mail Box">
<node label="Inbox">
<node label="Marketing"/>
<node label="Product Management">
<node label="Large node Large Node Large Node Large
Node"/>
</node>
<node label="Personal"/>
</node>
<node label="Outbox">
<node label="Professional"/>
<node label="Personal"/>
</node>
<node label="Spam"/>
<node label="Sent"/>
<node label="Spam2"/>
<node label="Sent2"/>
<node label="Spam3"/>
<node label="Sent3"/>
<node label="Spam4"/>
<node label="Sent4"/>
<node label="Spam5"/>
<node label="Sent5"/>
<node label="Spam6"/>
<node label="Sent6"/>
</node>
</mx:XMLList>
<mx:TabNavigator height="100%" width="1005">
<mx:Canvas label="Tree Issue">
<mx:Text x="284" y="51" fontSize="16" fontWeight="bold"
text="Issue: Expand the tree node to open up Product Management
node, no Horizontal Scroll bar appears." width="390"/>
<mx:Canvas verticalScrollPolicy="auto"
horizontalScrollPolicy="auto">
<mx:Tree x="50" y="50" width="226" height="303"
dataProvider="{treeData}" labelField="@label"
verticalScrollPolicy="auto" horizontalScrollPolicy="auto"/>
</mx:Canvas>
</mx:Canvas>
<mx:Canvas label="DataGrid Issue">
<mx:DataGrid id="dgTest" dataProvider="{dgData}"
width="500" height="300" x="10" y="10">
<mx:columns>
<mx:DataGridColumn headerText="Filled Row"
dataField="filled"/>
<mx:DataGridColumn headerText="Partially Filled Row"
dataField="partial"/>
</mx:columns>
</mx:DataGrid>
<mx:Text x="10" y="318" fontSize="16" fontWeight="bold"
text="Issue: Toggle the sort in the column that has only partial
data. You will get a find criteria error. This worked in Hotfix 2
and was broke in Hotfix 2." width="390"/>
</mx:Canvas>
</mx:TabNavigator>
</mx:Application>Hi,
With new hotfixes some bugs ( most of bugs) in Flex SDK are
get fixed, but rarely new (sometimes critical) bugs can appear.
Before Flex 3 release which will allow on IDE level to switch
between different versions of Flex SDK on the fly, I would advice
you to store locallly copy of all versions of Flex 2 SDK released
to the public. Then, in case if you will encounter a serious bug in
the most recent release of Flex 2 SDK, you can fix it by yourlself
by reusing the old code from former release of Flex 2 SDK.
See what I did with found bug in Flex 2.0.1 release, which is
what not present in Flex 2.0 SDK release:
jabbypanda.com/blog/?p=25 -
DataGrid sort efficiency questions
Hi,
I guess I have two specific questions:
1. Is sorting a DataGrid faster/slower/same by applying a
sortCompareFunction to a specific column vs. applying a Sort object
directly to the underlying dataprovider?
2. It says in the following link that if you use a
labelFunction on a column, you must also use a sortCompareFunction:
dataGridColumn.sortCompareFunction
ASDOC
Is this really true - anyone know why?
Thanks!
-NoahAlexander,
In Flex 3 sorting is controlled by the collections rather than the controls. This provides greater flexibility overall despite making it hard to adjust to. To get or set a sort on the DataGrid in Flex 3, use the sort property of its dataProvider:
ListCollectionView(dataGrid.dataProvider).sort
You can both read and write to the sort property. When you write to it, you have to call refresh() after for it to apply. Refer to the documentation on the ListCollectionView class for how to properly get and set its sort property.
Thanks,
Philip -
I have a DataGrid with several columns and I would like to be
able to sort it with a ComboBox. So if option a in the comboBox is
selected then column A in the DataGrid will be used to sort. I
option B is selected then a different column wil sort the DataGrid.
How would I go about this?
Thanks
Dave"dmschenk" <[email protected]> wrote in
message
news:gbe16o$c4p$[email protected]..
> I have a DataGrid with several columns and I would like
to be able to sort
> it
> with a ComboBox. So if option a in the comboBox is
selected then column A
> in
> the DataGrid will be used to sort. I option B is
selected then a
> different
> column wil sort the DataGrid. How would I go about this?
I think there's an example of this at
http://blog.flexexamples.com -
argh, frustrating!
Is it really possible that I cant sort a datagrid with script
when user presses the button.
Lets say datagrid have three columns. Col 1, col 2 and col 3.
I have three buttons that lead user to the datagrid and each
of them should sort the datagrid by the column user clicked
(equivalent button)?Just sort the underlying collection. Assuming your using an
arrayCollection
do the following:
userList.source.sortOn(["org","name"]);
This is a collection of user objects where I sort by org and
name.
Then either reset the grids dataprovider or send out a
Collection changed event:
var c:CollectionEvent = new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
userList.dispatchEvent(c) -
Is it possible to remove a sort from a datagrid column? I want to give the user the ability to remove a sort from a column since currently once they sort they can not unsort. Also, if I put new clear the data provider and put new data in the column stays sorted and that is not the preferred functionality.
Hello Silent Ryan,
This will clear the sort:
ListCollectionView(dataGrid.dataProvider).sort = null;
ListCollectionView(dataGrid.dataProvider).refresh();
Thanks,
Philip
Message was edited by: PhilipKeiter -
Problem in alphabetical sorting
Hi all
In reference to the following query posted:
Well, try this :
SQL> with tbl as
2 (select 'sap' c1 from dual union all
3 select 'sip' from dual union all
4 select '1123' from dual union all
5 select '1pouet3' from dual union all
6 select 'test' from dual union all
7 select '678' from dual union all
8 select 'test2' from dual )
9 select c1
10 from
11 (select 0 as c2, c1 as c1
12 from tbl
13 where translate(c1,'0123456789 ',' ') is not null
14 union all
15 select row_number() over (order by to_number(c1)), c1
16 from tbl
17 where translate(c1,'0123456789 ',' ') is null)
18 order by c2,c1;
C1
1pouet3
sap
sip
test
test2
678
1123
7 rows selected
I am thankful that your query worked out well....
But then I have a problem with it.
It does sort the list first alphabetically and then numerically. But the problem is, in alphabetcal sorting.It takes all the the words starting with capital letters as one set and the ones starting with small letters as a different set.So it will first alphabetically sort the capital words first, then the set of small letter words and finally the numbers. For eg:
LIST
annie
apple
Carrot
zaire
Zap
123
Yougurt
345
Ant
Break
Dark
success
After sorting it will give the list like this:(this is not what i need)
LIST
Ant
Break
Carrot
Dark
Yougurt
Zap
annie
apple
success
zaire
123
345
But I want the query to take the list of alphabetical words as one single set. I dont want it to make a differentiation between capital letters and small letters.
Also after sorting the capital and small letters in the original value should remain as such.i.e.; the data should not changed.Only the order should change.
So after performing the sort operation the list should be like:
(this is how I need)
LIST
annie
Ant
apple
Break
Carrot
Dark
success
Yougurt
zaire
Zap
123
345
Could you please suggest me a solution to my problem.
Thanking in advance......
Aswathy.What's your Oracle version?
check this article.
It covered your question very good,
http://orafaq.com/node/999
In summary, 10GR2 before, set NLS_COMP=ANSI
SQL> alter session set NLS_COMP='ANSI' ;
Session altered.
SQL> alter session set NLS_SORT='BINARY_CI' ;
Session altered.
SQL> select * from invoice_demo order by supplier_name ;
INVOICE_ID SUPPLIER_NAME
1003 janus pet supply
1001 MAX BOOKS
1000 Max Books
1002 max books10gR2 later,
NLS_COMP=LINGUISTIC
SQL> alter session set nls_comp='LINGUISTIC';
Session altered.
SQL> select * from invoice_demo
2 where supplier_name like 'M%';
INVOICE_ID SUPPLIER_NAME
1000 Max Books
1001 MAX BOOKS
1002 max books10gR2 new feature: Case Insensitive Sorts & Compares
Maybe you are looking for
-
How do I extend the storage space on my iphone?
Hi Guys I want to extend the storage space across my idevices since my wife can't stop taking photos of our new addition to the family on her iphone. We already both use iTunes Match so there is music on our phones it's all streamed off the cloud whi
-
N73 Shutting off for no apparent reason
Hi all I'm new here, I have already checked the site for similar postings and found one in particular that was identical to my subject heading, however, there is no remedy that I can see anywhere on this site, I did try to google it and the only fix
-
HT1414 How can I unlock my IPod that hasn't been connected to itunes yet and is disabled
Myt daughter lock her Ipod before I could connect it toItunes and it is now diabled can someone help me unlock it.
-
In regards to installing a hard drive with an OS...
I own a Macbook, and have got a hold of a MacBook Pro (Non-Unibody). I would like to know if I moved the hard drive from the former to the latter, would it work?
-
SAP XI not able to split message in BPM
Hello All, In our XI production system Message information is coming into the XI from CCS but XI BPM is not splitting the message to the external system . this is happening to one perticular interface. Message execution status is showing as successfu