20 Sep 2006 8:14 PM #1
Sort direction and sort images
Sort direction and sort images
2 bugs in the visual portion of the sorting:
1) The first time the grid is loaded, there is no sort graphic indicator present on the grid. Changing the sort order by clicking a header then displays the sort indicator. I've tried using the setDefaultSort() member function, but it doesn't change anything.
2) When clicking on a column header to change the sort, there is some confusing behavior. When it's first clicked, it sorts ascending. When you click again on the same column header, it sorts descending. That's all correct. The bug appears to be persistence attached to a column after you've already sorted it. After a fresh refresh of a grid, with Col1 being the default sort column, it comes up sorted ascending on Col1. If you click on Col2 it then sorts ascending for Col2. If you then click on Col1 again, it should set it back to Col1 being sorted ascending, but it actually sorts it descending (looks like it remembers the previous state of the column and flips it as it were the current column.) The column sort should remember its last sort order and resume that sort if it's not the currently sorted column.
20 Sep 2006 9:38 PM #2
1) If you don't supply a default sort, then it isn't sorted and no sort indicator is given. That is the correct behavior.
I need info on how setDefaultSort isn't working. A code example or a page. I am using it in the examples and it's works as expected. Just saying it's broken doesn't give enough info.
2) I agree, that is bad logic. I will fix it in this release.
Edit: #2 is fixed. The fix will be in the coming release.
20 Sep 2006 11:02 PM #3
From the example you posted, I added the default sort method. I'm assuming it's in the right place, which is pre-rendering. Whether I supply a default sort or not, it doesn't display the sort graphic until I actually click the column header.
If I'm doing something incorrectly, please let me know.
// create the Grid this.grid = new YAHOO.ext.grid.Grid('grid-example', dataModel, colModel); dataModel.setDefaultSort(colModel, 1, 'ASC'); var start = new Date().getTime(); this.grid.render(); var end = new Date().getTime(); //alert('Rendered in ' + ((end-start)/1000) + ' seconds'); this.grid.getSelectionModel().selectFirstRow();
20 Sep 2006 11:53 PM #4
Ah, I think I know what the problem is. You are using an array DataModel not Ajax style right?
The default sort was created for async loaders, where calling sort directly isn't an option since there's nothing to sort initially. With an array DM there's no need for a default sort, you can just call sort directly.
//dataModel.setDefaultSort(colModel, 1, 'ASC'); dataModel.sort(colModel, 1, 'ASC');
By galdaka in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 14 Mar 2007, 6:02 AM
By ericwaldheim in forum Community DiscussionReplies: 5Last Post: 29 Nov 2006, 7:26 AM
By tryanDLS in forum Ext 1.x: BugsReplies: 8Last Post: 10 Nov 2006, 7:27 AM
By Nanbe1st in forum Ext 1.x: BugsReplies: 0Last Post: 14 Oct 2006, 1:49 AM