X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/docs/source/list-view.html diff --git a/docs/source/list-view.html b/docs/source/list-view.html new file mode 100644 index 00000000..de5a9720 --- /dev/null +++ b/docs/source/list-view.html @@ -0,0 +1,61 @@ + + + The source code + + + + +
+Ext.onReady(function(){
+
+    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}',
+            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)');
+    });
+});
+ + \ No newline at end of file