简体   繁体   English

EXT-JS数据关联

[英]EXT-JS data association

Can you associate a component or element in EXT-JS with a arbitrary object? 您可以将EXT-JS中的组件或元素与任意对象相关联吗? eg store(component, 'key', obj) or get(component,'key'); 例如store(component, 'key', obj)get(component,'key');

I am not quite sure about the solution to this question, but you should check #extjs @ irc.freenode.net if nothing comes up here. 我对这个问题的解决方案不太确定,但是如果这里什么都没有发生,您应该检查#extjs @ irc.freenode.net。 They are very helpful people. 他们是很有帮助的人。

Hope this helps somehow. 希望这会有所帮助。

I just ran across this old unanswered question while retagging, so for posterity... 重新标记时,我只是遇到了这个旧问题,所以后代...

All referenced elements and created components are automatically cached in global hashes by the Ext framework. Ext框架将所有引用的元素和创建的组件自动缓存在全局哈希中。 For elements, you would retrieve them like so: 对于元素,您将像这样检索它们:

var myEl = Ext.get('myId');

Components are managed by the ComponentManager singleton and retrieved like so: 组件由ComponentManager单例管理并按以下方式检索:

var myComp = Ext.getCmp('myId');

If you simply want to store an arbitrary reference to an element, component or anything else for that matter, you can do so in any way that you would normally do it generically in JS (store off the var reference directly in application-level scope, store it in an array or hash object, etc.) 如果您只是想存储对元素,组件或其他任何东西的任意引用,则可以采用通常在JS中一般进行的任何方式进行存储(直接在应用程序级范围内存储var引用,将其存储在数组或哈希对象等中)

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

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