zoukankan      html  css  js  c++  java
  • [ExtJS5学习笔记]第十五节 Extjs5表格显示不友好?panel的frame属性在作怪

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39057243

    sencha官方API: http://docs.sencha.com/extjs/5.0/apidocs/#!/api/Ext.grid.Panel-cfg-store

    本文作者:sushengmiyan

    ------------------------------------------------------------------------------------------------------------------------------------

    Ext的官方样例显演示样例如以下:


    我写的代码。显示出来的就是这个样子?这是何原因?

    为什么我的Extjs中表格显示不友好?panel的frame属性在作怪


    标题栏没有排序那些也没有分隔条,下方的数据也是没有切割。看起来非常难受的。

    谁给看下症候在哪?


    代码例如以下:

    {
                xtype: 'panel',
    			region: 'center',
    			//layout: { type: 'fit' },
    			items:[{
    		      xtype: 'gridpanel',
    			  title: '表格面板',
    
    			  columns: [
                    { text: 'Name',  dataIndex: 'name'  },
                    { text: 'Email', dataIndex: 'email' ,flex: 1 },
                    { text: 'Phone', dataIndex: 'phone' }],
    
    			  store: Ext.create(
    				  'Ext.data.Store',
    				  {
    					 //alias: 'paneldatastore',
    					 //storeId:'simpsonsStore',
    					 fields:['name', 'email', 'phone'],
    					 data:{'items':[
    						{ 'name': 'Lisa',  "email":"lisa@simpsons.com",  "phone":"555-111-1224"  },
    						{ 'name': 'Bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },
    						{ 'name': 'Homer', "email":"homer@simpsons.com",  "phone":"555-222-1244"  },
    						{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254"  }
    					 ]},
    					 proxy: {
    						type: 'memory',
    						reader: {
    							type: 'json',
    							rootProperty: 'items'
    						}
    					}
    			  }),
    			}]
    	      }

    对照了官方提供的grid绑定xml文件的样例。发现须要将panel的frame属性设置为true。于是又一次来试一下:


    终于显示效果例如以下:


    最新代码例如以下:

    {
                xtype: 'panel',
    			frame: true,//加上frame属性,表格显示就友好了
    			region: 'center',
    			//layout: { type: 'fit' },
    			items:[{
    		      xtype: 'gridpanel',
    			  title: '表格面板',
    
    			  columns: [
                    { text: 'Name',  dataIndex: 'name'  },
                    { text: 'Email', dataIndex: 'email' ,flex: 1 },
                    { text: 'Phone', dataIndex: 'phone' }],
    
    			  store: Ext.create(
    				  'Ext.data.Store',
    				  {
    					 //alias: 'paneldatastore',
    					 //storeId:'simpsonsStore',
    					 fields:['name', 'email', 'phone'],
    					 data:{'items':[
    						{ 'name': 'Lisa',  "email":"lisa@simpsons.com",  "phone":"555-111-1224"  },
    						{ 'name': 'Bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },
    						{ 'name': 'Homer', "email":"homer@simpsons.com",  "phone":"555-222-1244"  },
    						{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254"  }
    					 ]},
    					 proxy: {
    						type: 'memory',
    						reader: {
    							type: 'json',
    							rootProperty: 'items'
    						}
    					}
    			  }),
    			}]
    	      }

    原因:panel的frame属性设置为true之后。就能够友好显示表格了。

  • 相关阅读:
    前端模板Nunjucks简介
    git提交时支持文件名大小写的修改
    多行文本加省略号的处理方法
    前端性能优化实践方案总结
    使用gulp工具生成svgsprites
    koa简介
    JSX语法简介
    踩坑所引发出的appendChild方法的介绍
    React业务实践
    javascript--数组
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5118232.html
Copyright © 2011-2022 走看看