View Full Version : [CLOSED] [Razor] DropDownField LazyInit property

May 24, 2012, 11:41 AM

In v2 Razor syntax I don't see method for setting LazyInit property in DropDownField. Is this syntax changed?

May 24, 2012, 12:34 PM
There is no such functionality in v2, picker control can be retrieved at any moment via 'getPicker' client side method
Can you describe what are you trying to achieve?

May 24, 2012, 12:51 PM
I try to explain:

I have two dropdown field-s. In both of them there is TreePanel. When user select one node from first treepanel i need to load (or reload) TreeStore for second treePanel. That means that second tree dinamicly loads.
My idea for solution is: when user double clicks on node from first treepanel I call listener handler and reload treeStore for second treePanel with function:

Ext.getCmp('TreePanelKontniPlanStavka').store.load ();

But this don't work because 'TreePanelKontniPlanStavka' is in dropDownField and inits first time when user drops down second dropDownField.

May 24, 2012, 12:54 PM
As I said before you can use 'getPicker' method

var tree = App.MyDropDownField2.getPicker();

May 24, 2012, 1:14 PM
Thanks, I just trying that. But now I have problem that treePanel loads two or three times. I don't know why.

May 24, 2012, 1:27 PM
That happens only first time I load treestore.

May 24, 2012, 1:35 PM
I guess that is your root node is not visible (RootVisible is false) therefore store is automatically loads its during creation
Try to set AutoLoad="false" for the store or make root is visible

May 24, 2012, 1:56 PM
This combination don't call controller twice:
Expanded(false) for root.
RootVisible(true) for TreePanel

AutoLoad does not have influence.

But I realy don't need to show root.

May 24, 2012, 2:25 PM
AutoLoad does not have influence.

It has been recently fixed. Please update from SVN or set up

<ext:ConfigItem Name="autoLoad" Value="false" Mode="Raw" />

May 24, 2012, 2:39 PM
Yes, it is fixed in SVN but there is one issue
If root is not visible and not loaded yet then need to use expand method instead store loading otherwise children will not be rendered
Therefore i suggest do not use AutoLoad="false" and use the following construction

var tree = App.MyDropDownField2.getPicker();
tree.store.getRootNode().isLoaded() && tree.store.load();

May 25, 2012, 10:36 AM
Yes, this suggestions and svn update helped me. Thanks!