zoukankan      html  css  js  c++  java
  • ExtJs GridPanel 给表格行或者单元格自定义样式

            Ext.onReady(function(){
                Ext.create('Ext.data.Store', {
                    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":"home@simpsons.com",  "phone":"555-222-1244"  },
                        { 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254"  }
                    ]},
                    proxy: {
                        type: 'memory',
                        reader: {
                            type: 'json',
                            root: 'items'
                        }
                    }
                });
    
                Ext.create('Ext.grid.Panel', {
                    title: 'Simpsons',
                    store: Ext.data.StoreManager.lookup('simpsonsStore'),
                    columns: [
                        { text: 'Name',  dataIndex: 'name' },
                        { text: 'Email', dataIndex: 'email', flex: 1 },
                        { text: 'Phone', dataIndex: 'phone' }
                    ],
                    height: 200,
                     400,
                    renderTo: Ext.getBody(),
                    viewConfig: {
    //这里可以根据我们自己的逻辑给表格添加样式 getRowClass:
    function(record, rowIndex, rowParams, store){ return "tasks-completed-task"; } }, }); });
            //给行添加样式
            .tasks-completed-task {
                color:#fb223a;
            }
            //行内单元格添加样式
            .tasks-completed-task .x-grid-cell {
                text-decoration: line-through;
                color: gray;
            }

    .tasks-completed-task .x-grid-cell(这种写法是CSS 样式 子元素选择器)

    意思是 父容器的CSS = tasks-completed-task 子元素的css = x-grid-cell 才会生效

  • 相关阅读:
    众多linux 库及工具意思的解释
    ubuntu root 登录
    Oscillator的参数解释
    世界观和方法论写给学弟学妹的
    元件的降额使用可靠度设计
    电子元件又一话——电感篇
    【转】什么是磁珠(Ferrite Bead 即 FB)
    Digital System Design Guidelines
    几种典型接口的电平标准
    珀耳帖效应
  • 原文地址:https://www.cnblogs.com/daxin/p/3220182.html
Copyright © 2011-2022 走看看