隨筆-9  評論-168  文章-266  trackbacks-0

           

          // 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)');
          }
          );
          posted on 2009-09-23 09:50 紫蝶∏飛揚↗ 閱讀(4528) 評論(1)  編輯  收藏 所屬分類: EXTJS

          評論:
          # re: Extjs ListView 詳解 2013-04-07 15:23 | Fuck you!
          Extjs ListView 詳解????
          就抄了下代碼??
          好意思說嗎你>??!!!!  回復  更多評論
            
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(5)

          隨筆檔案(9)

          文章分類(339)

          文章檔案(265)

          最新隨筆

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 金堂县| 安平县| 大冶市| 宜兰市| 五家渠市| 房山区| 莱芜市| 砚山县| 买车| 慈溪市| 繁昌县| 湘潭县| 武威市| 南通市| 伊春市| 平度市| 兴山县| 霍山县| 通州市| 澎湖县| 重庆市| 德兴市| 木兰县| 白银市| 西峡县| 武乡县| 金川县| 玉环县| 临沧市| 法库县| 遂溪县| 屏边| 凉城县| 桃源县| 元谋县| 思茅市| 玉溪市| 若羌县| 聂荣县| 开江县| 海口市|