-
27 Sep 2008 9:09 AM #1
Help - How to remove sort field when reload grid
Help - How to remove sort field when reload grid
When I click on the column header to sort column and click reload button on paging toolbar, the column still keep sort. How can I reset it. Thanks
Sorry for my bad English.
-
28 Sep 2008 11:17 PM #2
Add this line
stateful: false,
in new Ext.grid.GridPanel
-
28 Sep 2008 11:30 PM #3
Thanks v.sushma so much.
But the column still keep sort. I want reset it when grid is reloadedSorry for my bad English.
-
28 Sep 2008 11:45 PM #4
Code:delete myStore.sortInfo;
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
28 Sep 2008 11:47 PM #5Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Example:
Code:bbar: new Ext.grid.PagingToolbar({ onClick: function(which) { if (which == 'refresh') { delete this.store.sortInfo; } Ext.grid.PagingToolbar.prototype.onClick.apply(this, arguments); } ... })
-
29 Sep 2008 12:15 AM #6
Thanks Animal and Condor. The sortInfo now deleted successful. How can I reset the GUI ? I want to remove sort arrow on column header, too.
Sorry for my bad English.
-
29 Sep 2008 12:22 AM #7
Yes, there's a bif of a gap here. You'll have to do it yourself:
Code:myGrid.view.getHeaderCell(columnIndex).removeClass(["sort-asc", "sort-desc"]);
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
29 Sep 2008 12:29 AM #8
Add menuDisabled:true in columnFields.push
this.columnFields.push(
{dataIndex: 'PRODUCT', header: 'Product',sortable: true, width: 0,menuDisabled:true},
-
29 Sep 2008 12:48 AM #9
I think it's a bug.
GridView has (with my added comments in red):
It should ensure all arrow classes are removed if no sort state is found in the Store.Code:updateHeaderSortState : function(){ var state = this.ds.getSortState(); if(!state){ // It returns if no stort state found. return; // If it used to have a sort state, the arrows need removing } if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){ this.grid.fireEvent('sortchange', this.grid, state); } this.sortState = state; var sortColumn = this.cm.findColumnIndex(state.field); if(sortColumn != -1){ var sortDir = state.direction; this.updateSortIcon(sortColumn, sortDir); } },Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
14 Oct 2008 8:00 AM #10
I use such fix:
I hope this fix will be useful not only for me =)Code:/** * Fix grid view to update "unsorted" state correctly */ fix(Ext.grid.GridView, { // original header sort state update handler updateHeaderSortState$: Ext.grid.GridView.prototype.updateHeaderSortState, // hacked header sort state update handler // private updateHeaderSortState: function() { if(this.ds.getSortState()) { this.updateHeaderSortState$(); return; } if (!this.sortState) { return; } delete this.sortState; this.mainHd.select('td').removeClass(this.sortClasses); this.grid.fireEvent('sortchange', this.grid, null); } });


Reply With Quote