<html>
<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.2.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
*/
-<div id="cls-Ext.ListView.Sorter"></div>/**\r
- * @class Ext.ListView.Sorter\r
- * @extends Ext.util.Observable\r
- * <p>Supporting Class for Ext.ListView.</p>\r
- * @constructor\r
- * @param {Object} config\r
- */\r
-Ext.ListView.Sorter = Ext.extend(Ext.util.Observable, {\r
- <div id="cfg-Ext.ListView.Sorter-sortClasses"></div>/**\r
- * @cfg {Array} sortClasses\r
- * The CSS classes applied to a header when it is sorted. (defaults to <tt>["sort-asc", "sort-desc"]</tt>)\r
- */\r
- sortClasses : ["sort-asc", "sort-desc"],\r
-\r
- constructor: function(config){\r
- Ext.apply(this, config);\r
- Ext.ListView.Sorter.superclass.constructor.call(this);\r
- },\r
-\r
- init : function(listView){\r
- this.view = listView;\r
- listView.on('render', this.initEvents, this);\r
- },\r
-\r
- initEvents : function(view){\r
- view.mon(view.innerHd, 'click', this.onHdClick, this);\r
- view.innerHd.setStyle('cursor', 'pointer');\r
- view.mon(view.store, 'datachanged', this.updateSortState, this);\r
- this.updateSortState.defer(10, this, [view.store]);\r
- },\r
-\r
- updateSortState : function(store){\r
- var state = store.getSortState();\r
- if(!state){\r
- return;\r
- }\r
- this.sortState = state;\r
- var cs = this.view.columns, sortColumn = -1;\r
- for(var i = 0, len = cs.length; i < len; i++){\r
- if(cs[i].dataIndex == state.field){\r
- sortColumn = i;\r
- break;\r
- }\r
- }\r
- if(sortColumn != -1){\r
- var sortDir = state.direction;\r
- this.updateSortIcon(sortColumn, sortDir);\r
- }\r
- },\r
-\r
- updateSortIcon : function(col, dir){\r
- var sc = this.sortClasses;\r
- var hds = this.view.innerHd.select('em').removeClass(sc);\r
- hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);\r
- },\r
-\r
- onHdClick : function(e){\r
- var hd = e.getTarget('em', 3);\r
- if(hd && !this.view.disableHeaders){\r
- var index = this.view.findHeaderIndex(hd);\r
- this.view.store.sort(this.view.columns[index].dataIndex);\r
- }\r
- }\r
-});</pre>
+<div id="cls-Ext.list.Sorter"></div>/**
+ * @class Ext.list.Sorter
+ * @extends Ext.util.Observable
+ * <p>Supporting Class for Ext.list.ListView</p>
+ * @constructor
+ * @param {Object} config
+ */
+Ext.list.Sorter = Ext.extend(Ext.util.Observable, {
+ <div id="cfg-Ext.list.Sorter-sortClasses"></div>/**
+ * @cfg {Array} sortClasses
+ * The CSS classes applied to a header when it is sorted. (defaults to <tt>["sort-asc", "sort-desc"]</tt>)
+ */
+ sortClasses : ["sort-asc", "sort-desc"],
+
+ constructor: function(config){
+ Ext.apply(this, config);
+ Ext.list.Sorter.superclass.constructor.call(this);
+ },
+
+ init : function(listView){
+ this.view = listView;
+ listView.on('render', this.initEvents, this);
+ },
+
+ initEvents : function(view){
+ view.mon(view.innerHd, 'click', this.onHdClick, this);
+ view.innerHd.setStyle('cursor', 'pointer');
+ view.mon(view.store, 'datachanged', this.updateSortState, this);
+ this.updateSortState.defer(10, this, [view.store]);
+ },
+
+ updateSortState : function(store){
+ var state = store.getSortState();
+ if(!state){
+ return;
+ }
+ this.sortState = state;
+ var cs = this.view.columns, sortColumn = -1;
+ for(var i = 0, len = cs.length; i < len; i++){
+ if(cs[i].dataIndex == state.field){
+ sortColumn = i;
+ break;
+ }
+ }
+ if(sortColumn != -1){
+ var sortDir = state.direction;
+ this.updateSortIcon(sortColumn, sortDir);
+ }
+ },
+
+ updateSortIcon : function(col, dir){
+ var sc = this.sortClasses;
+ var hds = this.view.innerHd.select('em').removeClass(sc);
+ hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
+ },
+
+ onHdClick : function(e){
+ var hd = e.getTarget('em', 3);
+ if(hd && !this.view.disableHeaders){
+ var index = this.view.findHeaderIndex(hd);
+ this.view.store.sort(this.view.columns[index].dataIndex);
+ }
+ }
+});
+
+// Backwards compatibility alias
+Ext.ListView.Sorter = Ext.list.Sorter;</pre>
</body>
</html>
\ No newline at end of file