Remove datagrid sort
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
Similar Messages
-
ALV . How to remove the sort buttons on toolbar in ALV report?
Hi,experts
As you know, in default case , the alv report will display two sort buttons(ascending ,descending) on its toolbar , So How to remove the sort buttons on toolbar in ALV report?
Thanks for your help .Hi guixin,
1. Before calling REUSE_ALV_LIST_DISPLAY
2. Write this code :
data : excl type SLIS_T_EXTAB.
data : exclwa type SLIS_EXTAB.
exclwa = '&OUP'.
append exclwa to excl.
exclwa = '&ODN'.
append exclwa to excl.
3. Then while calling the FM,
pass this parameter also .
IT_EXCLUDING = excl
It will work fantastic.
regards,
amit m. -
How to remove the sort function on the drill down and then save
how to remove the sort function on the drill down and then save in the change local view of the Query
Is it possible to change the porperties of any characteristic in the local view and then save?
If so please post the answer.I do not think that option is possible.
Regards,
Venkata Boga. -
Remove/Hide sort for one of the table column
Hi all,
I have applied the sort functionality for the table control. But for only column i dont need the sort function.
I have tried with the below code before doing sorting...but i dont see any result....
ONACTIONSORT
data : gr_col type ref to CL_WD_ABSTR_TABLE_COLUMN.
CALL METHOD wd_this->table1->REMOVE_GROUPED_COLUMN
EXPORTING
id = 'TABLECOLUMN'
index = '8'
receiving
THE_GROUPED_COLUMN = gr_col
wd_this->table_control1->apply_sorting( )..
Could somebody suggest me how can to remove the sort function for a particular column.
Regards
Sireesha.Hi manas,
Thank u so much. Its working fine.
points assigned to you....
Regards
sireesha. -
Removing the "sort by: most recent" default option from my purchased items.
Is there a way to remove the "sort by: most recent" default option from my purchased items? It annoys me to see items that are not ordered alphabetically or by release date so I do not want there to be a record of this.
See:
* https://support.mozilla.com/en-US/kb/Resetting%20preferences -
DataGrid sort start/completion: specific associated events?
Hi all,
A lot of my DataGrid sorts take a non-trivial amount of time.
So, I'd like to show a busy cursor while the operation runs. In
order to do this I'd need events associated with the start and
completion of the operation. Are there such events available?
Thanks!
-NoahThis thread was "imported" from the old forums -- most, if not all, code seems to have disappeared. But here are the sort functions I posted:
function sortXML(source:XML, elementName:Object, fieldName:Object,
options:Object = null):XML
// list of elements we're going to sort
var list:XMLList=source.elements("*").(name()==elementName);
// list of elements not included in the sort -
// we place these back into the source node at the end
var excludeList:XMLList=source.elements("*").(name()!=elementName);
list= sortXMLList(list,fieldName,options);
list += excludeList;
source.setChildren(list);
return source;
function sortXMLList(list:XMLList, fieldName:Object, options:Object =
null):XMLList
var arr:Array = new Array();
var ch:XML;
for each(ch in list)
arr.push(ch);
var resultArr:Array = fieldName==null ?
options==null ? arr.sort() :arr.sort(options)
: arr.sortOn(fieldName, options);
var result:XMLList = new XMLList();
for(var i:int=0; i<resultArr.length; i++)
result += resultArr[i];
return result; -
Datagrid sorting issues with 1/0 items to consider
Hi all,
I have an issue I can't find a way to fix. I am using a datagrid which I pouplate through a XMListCollection based on some XML datas.
XML:
var prefs:XML = <files>
<file name="@toto" favourite="1"/>
<file name="@toto"favourite="0"/>
</files>;
XMLListCollection
var xlc:XMLListCollection = new XMLListCollection( new XMLList ( prefs.file) );
MXML
<mx:DataGrid id="filesList" width="100%" height="100%" dataProvider="{xlc}">
<mx:columns>
<mx:DataGridColumn width="25" dataField="@favourite"sortCompareFunction="favourite_sortCompareFunc"/>
</mx:columns>
</mx:DataGrid>
Sorting fucnction:
private function favourite_sortCompareFunc(itemA:Object, itemB:Object):int {
var value1:Number = Number( itemA.@favourite );
var value2:Number = Number( itemB.@favourite );
if(value1 < value2){
var n:Number = -1;
return n;
else if(value1 > value2){
return 1;
else{
return 0;
return 1;
Once loaded, the datagrid appears in a "normal state":
But if I try to sort first column, it becomes messy
I think it might be related to the fact that the data to be sorted is only made of 0 & 1. But I can't imagine this kind of situations is not fixable.
Any hint ?
Thanks in advance for any advice,
LoicHi guys,
First of all, all my apologizes for my silence. I had technical issues with Yahoo mail that made me miss 3 months mail ! So I just missed your posts and I can only come today to thank you all for your care and answers.
In the meanwhile, I finally got it working by doing…nothing. Let me explain. The issue was caused by equal datas ( 1 or 0 ). So Flex couldn't sort 1 and 1 or 0 and 0 by itself. But these 0 and 1 were flags for an itemrenderer made of a button in toggle mode. 1 standed for on, 0 for off.
Doing so I did override updateDisplayList and then the issue went away. But if I had to stick with pure datas ( 1 or 0 ) I think I would have had to do a custom sort function to deal with equal datas like a few of you offered.
@DonMitchinson the @ stands for the xml attribute as the datagrid is populated with XMLListCollection from an XML file.
Thanks for your sharing,
Best,
Loic -
How to remove a Sort button from ALV List
Hi Experts,
How to remove sort button from ALV List.
I have requirement where I need to remove the sort button from ALV list.
Kindly give me useful clues.
Higher points will be awarded for the useful inputs.
Thanks in Advance,
DharaniHi dharani,
1. UP and Down Sort Button will get removed.
2. Important code is marked in bold
3. Just copy paste.
4.
report abc.
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvfcwa TYPE slis_fieldcat_alv.
<b>data : excl type SLIS_T_EXTAB.
data : exclwa type SLIS_EXTAB.</b>
data : begin of itab occurs 0.
include structure usr02.
data : end of itab.
START-OF-SELECTION.
select * from usr02
into table itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
<b>*----
IMPORTANT
fcodes to remove
Up and Down Sort Button
exclwa-fcode = '&OUP'.
append exclwa to excl.
exclwa-fcode = '&ODN'.
append exclwa to excl.</b>
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
<b>IT_EXCLUDING = excl</b>
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m. -
Hi all,
We are running one query from Sql Query Analyser ,
for selecting values and displaying it in ascending order.
We are executing the same query from coding to load in to
datagrid , but its not arranging it by ascending order instead
its sorting randomly.
Because of this, if i select particular row from Datagrid, its not fetching
the selected row from the grid instead its taking corresponding row number's
value.
Thanks
VaithyHI vaitheeswaran l... ,
yeah what u said is correct grid takes in that manner when u are using collapse levels.try without using collapse levels.if u want using collapse levels it wont come
Edited by: micheal willis on Oct 9, 2009 11:34 AM -
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 Sort Clears HeaderRenderer Checkbox
I have a datagrid that I defined a checkbox as the
headerrenderer for one of the columns. It took me a while to track
this down, but it seems like a re-sort on one of the columns (other
than the checkbox headerrenderer column) clears the state of the
checkbox and resets it to chexkbox.selected=false.
Is there any way to persist the checkbox selected property of
a headerrenderer checkbox instance on re-sort.
I played with disabling the default sort methods and creating
my own sort functionality by only allowing a specific column to be
sorted. That didn't solve my problem though.
Thanks,
JBI did something similar with my DataGrid. The way I solved
the problem was to make a global variable to hold the checkBox's
checked value and then on the checkbox's click event ran a global
function to handle the setting of the global var:
<mx:DataGridColumn id="copyColumn" dataField="check"
width="35">
<mx:headerRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center"
verticalAlign="middle">
<mx:CheckBox id="check"
tabIndex="1" labelPlacement="top" selected="
{outerDocument.check_flg}"
click="
outerDocument.checkAll(check.selected)" height="18" />
</mx:HBox>
</mx:Component>
</mx:headerRenderer>
</mx:DataGridColumn>
note that the above code is contained in a component that
extends mx:DataGrid
I think you can get the jist... -
I have two datagrids. After a form is submitted, datagrid 1
is populated. Clicking on any of the rows will submit to another
query and populate datagrid 2.
If I have submitted my form and datagrid 1 is populated, and
I sort the columns, it will sort and kick of the second query.
Instead of sending to the HTTP service directly when clicking
on datagrid 1 header or row, I have it going to a routine. If the
user has not selected a row, and clicks a column, it will sort but
not submit.
However, that only gets me half the way there. If a user
selected a row in datagrid 1, and then sorts, it will still submit
to datagrid 2. Again, I don't see why if I'm clearly clicking on
the column header to sort that it should submit also.
Is there a way to make the column header independent of the
rows?I would not have expected that.
Pass "event" into the itemClick handler.
Use it to determine what was clicked, and do not make your
data service call if it is the header row. Not exactly how to
determine that, you will need to look at the contents of that
event. Maybe rowIndex = -1?
Tracy -
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 -
Figuring out datagrid sort programmatically
OK I've got a datagrid with 4 columns. I'm giving the end
user the opportunity to sort on any of these columns. They also
have a report that is generated based on the data in the grid, but
I'm wondering how determine on which column the grid is sorted, and
which (ascending / descending) order so that I can sort the report
in that exact same manner.
I've added some code on the headerRelease event to track this
information (storing it in the Cairngorm ModelLocator), but if you
trace the results it doesn't foot to what you're actually doing,
for example the following writes inconsistent (to the apparent
action being taken in the interface) info to the console. I can
always get the correct dataField property, but its sortDescending
property is almost always opposite of what the datagrid displays:
private function
handleHeaderRelease(dgEvent:DataGridEvent):void
for(var k:int=0;k<myGrid.columns.length;k++)
trace(myGrid.columns[k].dataField + ":" +
myGrid.columns[k].sortDescending);
trace("");
Does anyone know of a better way to figure out on which
column the grid is currently sorted, and what sort nature is
currently applied?
TIA,
JoeOK I figured this out after remembering that the dataprovider
of the datagrid is just an ArrayCollection - here's the answer for
anyone who's looking for the same thing.
In the function that calls the report:
var s:Sort;
var sF:SortField;
s = summaryGrid.dataProvider.sort;
// if sort is null, they haven't clicked any column headers,
so use the default
if(s == null)
urlVariables.sortOrder = "dtAdded";
urlVariables.sortNature = "DESC";
otherwise use the first sort field
(this could be modified to build an appropriate order by
statement for multiple
sort fields if necessary)
else
sF = s.fields[0];
urlVariables.sortOrder = sF.name;
urlVariables.sortNature = sF.descending?"DESC":"ASC";
Hope this helps someone!
Maybe you are looking for
-
Unmerge cells using report generation
Hi, I have an issue using report generation toolkit, I'm writting text data to a range of cells and the cells get merged because of that. So I need to unmerge cells in order to be able to write again in thoose cells, because if the cells are merged
-
The subject says it all. Every time I open a file, Dreamweaver connects to the testing server and uploads the local file to the test server. I want to stop this behaviour. It's annoying!
-
Opening and locating files received by email.
I receive a email that contains an Adobe file. I click the file and below it an option to save to my computer. I click that save and presumably the file is saved to my computer. I cannot locate this file. I am doing some process wrong. Would someone
-
Can i use two registers in one Rate ?
Geeks, There is a meter with two registers and i want to compare these two registers in a single rate, but when i m creating a rate, in header data it is asking me to provide Reg. Oper. (Register operand in rate) and only this operand is reflecting i
-
Calculate and analyse variances for PM orders
Dear all, How the Costs and activity planning can be done for all PM orders and Calculate and analyse variances on periodical basis?? Thanks and regards