如何使用 Jquery $(“.something") 在 ExtJS 中选择一个类? [英] How to use Jquery $(".something") to select a class in ExtJS?
问题描述
我正在寻找一种等效的方法来在 ExtJS 的 Jquery 中选择像 $(".className") 这样的类元素.
I'm looking for an equivalent method to select a class element like this $(".className") in Jquery for ExtJS.
我知道 Ext.get() 只接受一个 id.您的帮助将不胜感激.
I understand that Ext.get() only takes in an id. Your help will be very much appreciated.
干杯,米奇
已
让我进一步解释.在我做了一个选择"之后,我希望能够做一些类似 Ext.get 的事情.例如:
Let me explain further. I want to be able to do something like Ext.get after I did a "select". For example:
$(".className").css("width");
我知道 Ext.Element 有 getWidth() 方法.我希望我能做一些像......
I understand that Ext.Element has getWidth() method. I was hoping I can do something like...
Ext.select(".className").getWidth(); // it just return me [Object object]
可能我不太明白.
谢谢一百万.
推荐答案
我认为您正在寻找:
Ext.query(".className");
此方法允许您像 jQuery 一样通过给定的查询字符串获取元素.
This method allows you to get elements by the given query string like jQuery does.
编辑
var els=Ext.query(".className"), ret=[];
for(var i=0; i<els.length; i++)
{
ret.push(els[i].getWidth());
}
这篇关于如何使用 Jquery $(“.something") 在 ExtJS 中选择一个类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!