-
8 Mar 2007 12:09 PM #1
Clear grid's sort arrow icon
Clear grid's sort arrow icon
I added a click handler to the paging toolbar's reset button (nice addition in 1.0, by the way) that changes the remoteSort to true and the sort column to 'default' to make it be a complete reset. It seems to work quite well, except that the arrow icon in the column header isn't cleared out after the grid reloads. Would this be considered a bug, or is there some function I can call manually to remove the arrow?
-
8 Mar 2007 3:45 PM #2
There's no way for it to know that the sort changed unless you tell it. There are two ways, and if way 1 (below)doesn't work I will post a longer way that is sure to work.
Note, this will only work if you actually updated the sortInfo property on the data store.Code:grid.getView().updateHeaderSortState();
-
9 Mar 2007 8:24 AM #3
Just calling that function doesn't work, since I'm setting the sortInfo.field to a non-existent column ('default', which is the order determined by the script that returns the data). I looked inside that function, though, and found the line that I need to just remove the arrow:
Not sure if changing updateHeaderSortState() to just remove the arrow if sortInfo.field doesn't exist is something you'd want to do.[/code]Code:grid.getView().el.select(grid.getView().headerSelector).removeClass(grid.getView().sortClasses);
-
9 Mar 2007 3:45 PM #4
That was going to be my second suggestion.

Local variables are always a good idea.
Code:// grid.getView().el.select(grid.getView().headerSelector).removeClass(grid.getView().sortClasses); var view = grid.getView(); view.el.select(view.headerSelector).removeClass(view.sortClasses);
-
13 Dec 2007 9:28 PM #5
reset grid columns in EXT 2.0??
reset grid columns in EXT 2.0??
I am trying to programmatically reset a grid in EXT 2.0 using both of the methods mention in this thread and have not had any luck.
I noticed that the posts in this thread are quite old and am hoping there is a "newer, better" way to reset sort column headers programmatically.
Any ideas?
-
20 Jan 2009 4:33 AM #6
This worked for me:
Code:grid.getView().updateHeaders();
-
5 Oct 2011 5:49 AM #7
This works
This works
Say you want to reset the grid data via a reset button located somewhere on your form, just add this handler to your button:
Code:handler : function() { myGrid = Ext.getCmp('mygrid_id'); // Removes any sorting done to the grid delete myGrid.store.sortInfo; myGrid.store.reload({ params: { start:0, limit: 150 } }); }
Similar Threads
-
clear grid totaly
By emi in forum Ext 1.x: Help & DiscussionReplies: 10Last Post: 25 Apr 2012, 10:28 AM -
use arrow keys when editing a grid cell?
By chachi in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 28 Mar 2007, 6:51 AM -
Fire clear event when Store is empty?
By aconran in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 22 Feb 2007, 4:39 PM -
using keyboard (arrow up/ down) in grid with FF?
By franklt69 in forum Ext 1.x: Help & DiscussionReplies: 15Last Post: 6 Feb 2007, 6:00 AM -
Sort direction and sort images
By dfenwick in forum Ext 1.x: BugsReplies: 3Last Post: 20 Sep 2006, 11:53 PM


Reply With Quote