Aug 16, 2012, 8:05 AM
[CLOSED] TreePanel focus
Related to this thread http://forums.ext.net/showthread.php...d-ENTER-keymap
I would do the same with treepanel in itemexpand listener:
TREEPANEL
I would do the same with treepanel in itemexpand listener:
TREEPANEL
<ext:TreePanel ID="sampleTreePanel" runat="server" Layout="FitLayout"
Border="false" RootVisible="false" AutoScroll="true">
<View>
<ext:TreeView runat="server" LoadingUseMsg="false" LoadMask="false" TrackOver="true">
<KeyMap runat="server">
<Binding>
<ext:KeyBinding DefaultEventAction="StopEvent" Handler="alert('works');">
<Keys>
<ext:Key Code="ENTER" />
</Keys>
</ext:KeyBinding>
</Binding>
</KeyMap>
</ext:TreeView>
</View>
<Store>
<ext:TreeStore ID="sampleTreeStore" runat="server">
<Proxy>
<ext:AjaxProxy Url='<%# this.Page.GetRouteUrl(this.Area, new { controller="MyController", action="MyAction" }) %>' AutoDataBind="true">
</ext:AjaxProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" />
</Root>
<Listeners>
<ItemExpand Fn="onExpand" />
</Listeners>
</ext:TreePanel>
LISTENER HANDLERonLoaded: function (loadNode) {
var nodeId = parseInt(loadNode.data.id, 10);
var hasRecords = ((nodeId== 0 && loadNode.childNodes.length > 0) || nodeId!= 0);
if (nodeId== 0 && hasRecords) {
sampleTreePanel.getSelectionModel().select(loadNode.childNodes[0], false); //This works and select first item
if (sampleTreePanel.getView().viewReady == true)
sampleTreePanel.getView().focusCell({ row: 0, column: 0 });
else
sampleTreePanel.getView().on('viewready', function () { sampleTreePanel.getView().focusCell({ row: 0, column: 0 }); });
},
How I must use focusCell? In Ext.JS docs this function doesn't appear documented but it appears in source code.
Last edited by Daniil; Aug 16, 2012 at 1:21 PM.
Reason: [CLOSED]