PDA

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



boris
May 24, 2012, 12:41 PM
Hi,

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

Vladimir
May 24, 2012, 1: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?

boris
May 24, 2012, 1: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.

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


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

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

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

Vladimir
May 24, 2012, 2: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

boris
May 24, 2012, 2: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.

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

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

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

Vladimir
May 24, 2012, 3: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();

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