Using Displaymode on flyweight elements - Ext JS

1689 단어 Ajaxext
What is the proper way to switch to displaymode when using flyweight elements. It is my understanding that the 'flyweight' element is just a single object which you can dynamically point to different DOM HTMLElements. Therefore code like this:
			Ext.fly('book-title-form').setVisibilityMode(Ext.Element.DISPLAY).show();
			Ext.fly('book-isbn-form').show();
			Ext.fly('book-keywords-form').show();
			Ext.fly('book-description-form').show();

This will work... so my question is knowing that I'm the only developer and nothing is going to happen in between the 1st statement and the last that would change the display mode.... is this safe?
  #
2  
02-25-2007, 05:23 AM
It should be fine. Just make sure you change it back!
  #
3  
02-25-2007, 10:00 AM
General question as I'm still pretty new to ext:
So Ext.fly is to be preferred over Ext.get if I just need the element for one call in that place?
  #
4  
02-25-2007, 10:08 AM
Yep. It can decrease memory usage - especially for elements which can be removed from the document at any time (like via ajax).
  #
5  
02-25-2007, 10:18 AM
Ok, thanks. Am I missing something or does mask/unmask not work with fly?
Ext.get("gridDiv").mask();

works, but
Ext.fly("gridDiv").mask();

does not (but also gives no error).
  #
6  
02-25-2007, 10:51 AM
Any stateful operation (masking, event handlers using "this", shims, etc) need a normal Element.

좋은 웹페이지 즐겨찾기