X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..c8256059947f3aa8f5b0a9a2acf55e2142bb4742:/src/widgets/list/ListView.js?ds=sidebyside diff --git a/src/widgets/list/ListView.js b/src/widgets/list/ListView.js index d02bdf77..66ec80e0 100644 --- a/src/widgets/list/ListView.js +++ b/src/widgets/list/ListView.js @@ -1,357 +1,377 @@ /*! - * Ext JS Library 3.0.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.2.1 + * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ -/** - * @class Ext.ListView - * @extends Ext.DataView - *
Ext.ListView is a fast and light-weight implentation of a - * {@link Ext.grid.GridPanel Grid} like view with the following characteristics:
- *Example usage:
- *
-// consume JSON of this form:
-{
- "images":[
- {
- "name":"dance_fever.jpg",
- "size":2067,
- "lastmod":1236974993000,
- "url":"images\/thumbs\/dance_fever.jpg"
- },
- {
- "name":"zack_sink.jpg",
- "size":2303,
- "lastmod":1236974993000,
- "url":"images\/thumbs\/zack_sink.jpg"
- }
- ]
-}
-var store = new Ext.data.JsonStore({
- url: 'get-images.php',
- root: 'images',
- fields: [
- 'name', 'url',
- {name:'size', type: 'float'},
- {name:'lastmod', type:'date', dateFormat:'timestamp'}
- ]
-});
-store.load();
-
-var listView = new Ext.ListView({
- store: store,
- multiSelect: true,
- emptyText: 'No images to display',
- reserveScrollOffset: true,
- columns: [{
- header: 'File',
- width: .5,
- dataIndex: 'name'
- },{
- header: 'Last Modified',
- width: .35,
- dataIndex: 'lastmod',
- tpl: '{lastmod:date("m-d h:i a")}'
- },{
- header: 'Size',
- dataIndex: 'size',
- tpl: '{size:fileSize}', // format using Ext.util.Format.fileSize()
- align: 'right'
- }]
-});
-
-// put it in a Panel so it looks pretty
-var panel = new Ext.Panel({
- id:'images-view',
- width:425,
- height:250,
- collapsible:true,
- layout:'fit',
- title:'Simple ListView (0 items selected)',
- items: listView
-});
-panel.render(document.body);
-
-// little bit of feedback
-listView.on('selectionchange', function(view, nodes){
- var l = nodes.length;
- var s = l != 1 ? 's' : '';
- panel.setTitle('Simple ListView ('+l+' item'+s+' selected)');
-});
- *
- * @constructor
- * @param {Object} config
- * @xtype listview
- */
-Ext.ListView = Ext.extend(Ext.DataView, {
- /**
- * Set this property to true to disable the header click handler disabling sort
- * (defaults to false).
- * @type Boolean
- * @property disableHeaders
- */
- /**
- * @cfg {Boolean} hideHeaders
- * true to hide the {@link #internalTpl header row} (defaults to false so
- * the {@link #internalTpl header row} will be shown).
- */
- /**
- * @cfg {String} itemSelector
- * Defaults to 'dl' to work with the preconfigured {@link Ext.DataView#tpl tpl}.
- * This setting specifies the CSS selector (e.g. div.some-class or span:first-child)
- * that will be used to determine what nodes the ListView will be working with.
- */
- itemSelector: 'dl',
- /**
- * @cfg {String} selectedClass The CSS class applied to a selected row (defaults to
- * 'x-list-selected'). An example overriding the default styling:
-
- .x-list-selected {background-color: yellow;}
-
- * @type String
- */
- selectedClass:'x-list-selected',
- /**
- * @cfg {String} overClass The CSS class applied when over a row (defaults to
- * 'x-list-over'). An example overriding the default styling:
-
- .x-list-over {background-color: orange;}
-
- * @type String
- */
- overClass:'x-list-over',
- /**
- * @cfg {Boolean} reserveScrollOffset
- * By default will defer accounting for the configured {@link #scrollOffset}
- * for 10 milliseconds. Specify true to account for the configured
- * {@link #scrollOffset} immediately.
- */
- /**
- * @cfg {Number} scrollOffset The amount of space to reserve for the scrollbar (defaults to
- * 19 pixels)
- */
- scrollOffset : 19,
- /**
- * @cfg {Boolean/Object} columnResize
- * Specify true or specify a configuration object for {@link Ext.ListView.ColumnResizer}
- * to enable the columns to be resizable (defaults to true).
- */
- columnResize: true,
- /**
- * @cfg {Array} columns An array of column configuration objects, for example:
- *
-{
- align: 'right',
- dataIndex: 'size',
- header: 'Size',
- tpl: '{size:fileSize}',
- width: .35
-}
- *
- * Acceptable properties for each column configuration object are:
- * Function which can be overridden which returns the data object passed to this - * view's {@link #tpl template} to render the whole ListView. The returned object - * shall contain the following properties:
- *Ext.list.ListView is a fast and light-weight implentation of a + * {@link Ext.grid.GridPanel Grid} like view with the following characteristics:
+ *Example usage:
+ *
+// consume JSON of this form:
+{
+ "images":[
+ {
+ "name":"dance_fever.jpg",
+ "size":2067,
+ "lastmod":1236974993000,
+ "url":"images\/thumbs\/dance_fever.jpg"
+ },
+ {
+ "name":"zack_sink.jpg",
+ "size":2303,
+ "lastmod":1236974993000,
+ "url":"images\/thumbs\/zack_sink.jpg"
+ }
+ ]
+}
+var store = new Ext.data.JsonStore({
+ url: 'get-images.php',
+ root: 'images',
+ fields: [
+ 'name', 'url',
+ {name:'size', type: 'float'},
+ {name:'lastmod', type:'date', dateFormat:'timestamp'}
+ ]
+});
+store.load();
+
+var listView = new Ext.list.ListView({
+ store: store,
+ multiSelect: true,
+ emptyText: 'No images to display',
+ reserveScrollOffset: true,
+ columns: [{
+ header: 'File',
+ width: .5,
+ dataIndex: 'name'
+ },{
+ header: 'Last Modified',
+ width: .35,
+ dataIndex: 'lastmod',
+ tpl: '{lastmod:date("m-d h:i a")}'
+ },{
+ header: 'Size',
+ dataIndex: 'size',
+ tpl: '{size:fileSize}', // format using Ext.util.Format.fileSize()
+ align: 'right'
+ }]
+});
+
+// put it in a Panel so it looks pretty
+var panel = new Ext.Panel({
+ id:'images-view',
+ width:425,
+ height:250,
+ collapsible:true,
+ layout:'fit',
+ title:'Simple ListView (0 items selected)',
+ items: listView
+});
+panel.render(document.body);
+
+// little bit of feedback
+listView.on('selectionchange', function(view, nodes){
+ var l = nodes.length;
+ var s = l != 1 ? 's' : '';
+ panel.setTitle('Simple ListView ('+l+' item'+s+' selected)');
+});
+ *
+ * @constructor
+ * @param {Object} config
+ * @xtype listview
+ */
+Ext.list.ListView = Ext.extend(Ext.DataView, {
+ /**
+ * Set this property to true to disable the header click handler disabling sort
+ * (defaults to false).
+ * @type Boolean
+ * @property disableHeaders
+ */
+ /**
+ * @cfg {Boolean} hideHeaders
+ * true to hide the {@link #internalTpl header row} (defaults to false so
+ * the {@link #internalTpl header row} will be shown).
+ */
+ /**
+ * @cfg {String} itemSelector
+ * Defaults to 'dl' to work with the preconfigured {@link Ext.DataView#tpl tpl}.
+ * This setting specifies the CSS selector (e.g. div.some-class or span:first-child)
+ * that will be used to determine what nodes the ListView will be working with.
+ */
+ itemSelector: 'dl',
+ /**
+ * @cfg {String} selectedClass The CSS class applied to a selected row (defaults to
+ * 'x-list-selected'). An example overriding the default styling:
+
+ .x-list-selected {background-color: yellow;}
+
+ * @type String
+ */
+ selectedClass:'x-list-selected',
+ /**
+ * @cfg {String} overClass The CSS class applied when over a row (defaults to
+ * 'x-list-over'). An example overriding the default styling:
+
+ .x-list-over {background-color: orange;}
+
+ * @type String
+ */
+ overClass:'x-list-over',
+ /**
+ * @cfg {Boolean} reserveScrollOffset
+ * By default will defer accounting for the configured {@link #scrollOffset}
+ * for 10 milliseconds. Specify true to account for the configured
+ * {@link #scrollOffset} immediately.
+ */
+ /**
+ * @cfg {Number} scrollOffset The amount of space to reserve for the scrollbar (defaults to
+ * undefined). If an explicit value isn't specified, this will be automatically
+ * calculated.
+ */
+ scrollOffset : undefined,
+ /**
+ * @cfg {Boolean/Object} columnResize
+ * Specify true or specify a configuration object for {@link Ext.list.ListView.ColumnResizer}
+ * to enable the columns to be resizable (defaults to true).
+ */
+ columnResize: true,
+ /**
+ * @cfg {Array} columns An array of column configuration objects, for example:
+ *
+{
+ align: 'right',
+ dataIndex: 'size',
+ header: 'Size',
+ tpl: '{size:fileSize}',
+ width: .35
+}
+ *
+ * Acceptable properties for each column configuration object are:
+ * Function which can be overridden which returns the data object passed to this + * view's {@link #tpl template} to render the whole ListView. The returned object + * shall contain the following properties:
+ *