热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Ext-JSQuicktipIconCSS问题-Ext-JSQuicktipIconCSSQuestion

Ivecreatedacustomvtypetoverifymyemails,myTOfieldusesanexclamation.jpgicon,butIwan

I've created a custom vtype to verify my emails, my TO field uses an exclamation.jpg icon, but I want my CC and BCC fields to use a warning icon (since its not req). I've been trying to wrap my head around navigating Ext-JS's API to determine what attributes I had access to (do I have access to attributes that the VType extends from?), and where I needed to specify this.

我创建了一个自定义vtype来验证我的电子邮件,我的TO字段使用了exclamation.jpg图标,但我希望我的CC和BCC字段使用警告图标(因为它不是req)。我一直试图围绕导航Ext-JS的API来确定我可以访问的属性(我是否可以访问VType扩展的属性?),以及我需要指定的位置。

I see through firebug the invalid message uses the css class .x-form-invalid-msg, how could I tell it to look at a different CSS class (looking at firebug I don't know what ID to reference)? Could I utilize the cls: attribute? Or Could I utilize an Ext.get and tweak the cls attribute?

我通过firebug看到无效消息使用css类.x-form-invalid-msg,我怎么能告诉它看一个不同的CSS类(看看firebug我不知道要引用什么ID)?我可以使用cls:属性吗?或者我可以利用Ext.get并调整cls属性吗?

EDIT**

编辑**

I just found the invalidClass Attribute... but I can't seem to get it working. Investigating...

我刚刚找到了invalidClass属性......但我似乎无法让它工作。调查...

EDIT**

编辑**

So it looks like adding the invalidClass attribute to the CC Textbox causes the CC class to reflect the change, but the VType Error isn't changing.

因此,将invalidClass属性添加到CC文本框看起来会导致CC类反映更改,但VType错误不会更改。


Code for my vType Below (does vType have a cls: it can use?):

Ext.apply( Ext.form.VTypes, 
            {
               anEmail:  function(emailString) 
               {
                  var temp = new Array();
                  temp = emailString.split(",");
                  for (var i = 0; i


EDIT** Hey I figured it out after looking @Jollymorphic explanation. My CSS had the extra problem that these textboxes were in form elements. I applied the CSS rule to the ID's of the fields that contained the x-form-invalid class. So it looks similar to this.

#x-form-el-bcc .x-form-invalid-msg{
color: #4279b5;
font: normal 11px tahoma, arial, helvetica, sans-serif;
background-image: url(../images/iwe/shared/warning.gif);
}

#x-form-el-cc .x-form-invalid-msg{
color: #4279b5;
font: normal 11px tahoma, arial, helvetica, sans-serif;
background-image: url(../images/iwe/shared/warning.gif);
}

1 个解决方案

#1


0  

You could use the cls configuration property to attach a custom CSS class to each of the components whose invalid icons you want to change, and then add a rule to your CSS stylesheet along these lines:

您可以使用cls配置属性将自定义CSS类附加到要更改其无效图标的每个组件,然后沿着以下行向CSS样式表添加规则:

.your-special-class .x-form-invalid-msg
{
   background-image: url("../my-images/my-warning.gif");
}

The textfields would look like this:

文本字段看起来像这样:

items: [{
  // ...
  vtype: "yourVType",
  cls: "your-special-class",
  // ...
}, {
  // ...
  vtype: "yourVType",
  cls: "your-special-class",
  // ...
}, {
  // Some other textfield with no special vtype or cls properties.
}]

The end result is this:

最终结果如下:

  • Each of your special text fields includes "your-special-class" in the class attribute of the DIV that contains both the textfield and its (normally hidden) invalid contents message.
  • 每个特殊文本字段在DIV的class属性中包含“your-special-class”,其中包含textfield及其(通常隐藏的)无效内容消息。
  • When the invalid message is shown, the CSS selector above applies to it more specifically than the simple .x-form-invalid-msg selector in Ext's CSS stylesheet because it specifies both the class of the invalid message element itself as well as the class of the DIV that contains it.
  • 当显示无效消息时,上面的CSS选择器比Ext的CSS样式表中的简单.x-form-invalid-msg选择器更具体地应用它,因为它指定了无效消息元素本身的类以及类包含它的DIV。
  • Being more specific, the background-image attribute specified in your CSS rule overrides its counterpart in the Ext stylesheet, so that your background image is now used instead of the one from the Ext default theme.
  • 更具体地说,CSS规则中指定的background-image属性会覆盖Ext样式表中的对应属性,以便现在使用背景图像而不是Ext默认主题中的背景图像。

推荐阅读
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 本文介绍了使用Java实现大数乘法的分治算法,包括输入数据的处理、普通大数乘法的结果和Karatsuba大数乘法的结果。通过改变long类型可以适应不同范围的大数乘法计算。 ... [详细]
  • Mac OS 升级到11.2.2 Eclipse打不开了,报错Failed to create the Java Virtual Machine
    本文介绍了在Mac OS升级到11.2.2版本后,使用Eclipse打开时出现报错Failed to create the Java Virtual Machine的问题,并提供了解决方法。 ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • 深入理解Kafka服务端请求队列中请求的处理
    本文深入分析了Kafka服务端请求队列中请求的处理过程,详细介绍了请求的封装和放入请求队列的过程,以及处理请求的线程池的创建和容量设置。通过场景分析、图示说明和源码分析,帮助读者更好地理解Kafka服务端的工作原理。 ... [详细]
  • 用JavaScript实现的太空人手表
    用JavaScript实现的太空人手表-JS写的太空人手表,没有用canvas、svg。主要用几个大的函数来动态显示时间、天气这些。天气的获取用到了AJAX请求。代码中有详细的注释 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • 表单提交前的最后验证:通常在表单提交前,我们必须确认用户是否都把必须填选的做了,如果没有,就不能被提交到服务器,这里我们用到表单的formname.submit()看演示,其实这个对于我们修炼道 ... [详细]
  • [JavaScript] 多数前端工程师都没注意到的一个关于console.log()的坑
    [JavaScript]多数前端工程师都没注意到的一个关于console.log()的坑请阅读以下代码并猜测结果:functiontest(){le ... [详细]
author-avatar
楼外蔷薇花开
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有