简体   繁体   English

sencha GXT CSS类

[英]sencha GXT css classes

i'm having problems with styling grid in gxt, the thing is that the elements in the grid get (i don't know how exactly) css class named ".GKA1XC4LIC" and this class overrides the settings, provided by my own css class (in my own css file). 我在gxt中设置网格样式时遇到问题,问题是网格中的元素获得了(我不知道怎么精确)名为“ .GKA1XC4LIC”的CSS类,并且该类覆盖了由我自己的CSS类提供的设置(在我自己的CSS文件中)。 However some properties (like font-size) i'm able to change with my class (i mean my css file is being loaded). 但是,某些属性(如font-size)可以随我的类进行更改(我的意思是我的css文件正在加载)。

i guess this .GKA1XC4LIC class is generated somewhere i don't know where. 我猜这个.GKA1XC4LIC类是在我不知道在哪里的地方生成的。 Why it is done this way? 为什么这样做呢? Am i doing this completely wrong? 我这样做是完全错误的吗?

i set class name like this: 我像这样设置类名:

codeColumnConfig.setColumnTextClassName("smk-grid-text");

thanks 谢谢

I assume you are using GXT3. 我假设您正在使用GXT3。 You said some properties are set by changing the css. 您说过通过更改CSS可以设置一些属性。 That is because the GXT3 has not set them and so they work. 那是因为GXT3尚未设置它们,所以它们可以工作。

To do use the GXT3 Appearnces correctly, it may be best to see this section Styling a GXT 3 application in the migration guide. 要正确使用GXT3外观,最好在迁移指南中参阅本节样式GXT 3应用程序 It's about the middle of the page. 它在页面的中间。

It explains the two ways to modify the Appearance pattern that GXT3 uses. 它说明了修改GXT3使用的外观模式的两种方法。

  1. via configuration (in the GWT module XML file) 通过配置(在GWT模块XML文件中)
  2. via constructor arguments 通过构造函数参数

There is another explanation in the Sencha docs for Appearances Sencha文档中还有关于外观的另一种解释

That said, that is pretty involved depending on how much you need to change things. 也就是说,这取决于您需要进行多少更改。

To do it quickly, I sometimes use a cell to render it how I need: 为了快速完成,有时我会使用一个单元格按照需要渲染它:

For example to render a cell in a grid a particular way I would do 例如,以特定方式渲染网格中的单元格

        ColumnConfig<Users, String> userCol = new ColumnConfig<SelectUserDialog.Users, String>(selectUserProperties.userName(), 240);

        AbstractCell<String> c2 = new AbstractCell<String>() {

            @Override public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {
                value = "<div  style=\"font-size:2.5EM; line-height : 30px; height=40px\" >" + value + "</div>";
                sb.appendHtmlConstant(value);
            }
        };

        userCol.setCell(c2);

If you are not using ColumnConfig already, you may need to see ValueProvider and ProperyAccess 如果尚未使用ColumnConfig,则可能需要查看ValueProviderProperyAccess

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM