welcome to my space
- i need some informat
- i gave away all my r
- what colour is my mi
- did my rabbit miscar
- is it okay for my bu
- produce 12v or 24v f
- my rabbits keep spil
- math help algebra 1
- teleporters are defi
- what do you actually
- what kind of spider
- really basic algebra
- what are the practic
-
Archives
-
Categories
-
Search
-
Meta
-
Credits
15 March, 2010 |
how to set focus on a field in a dialog?
Thanks in advance.
If you are using dynamic forms you can do something like this:
Ext.getCmp('myTextField').focus();
Thanks for the reply.
I do have an id assigned to the text field, and it's pre-generated markup. Should I use Ext.getDom("myTextField").focus() instead?
Thanks for your kind help.
Ext.fly('myTextField').focus();
Ext.fly('myTextField').focus();
Thanks. i tried Ext.fly('myTextField').focus(), but it does not work. This is my code:
_thisDialog.show(el);
Ext.fly("myTextId").focus();
Anything wrong with that? Thanks a lot.
If you are using dynamic forms you can do something like this:
Ext.getCmp('myTextField').focus();
Thanks for your reply. I use the Extjs example code. The RED highlight is part you maybe interested. Your help will be greatly appreciated.
-- Hello.js --
var HelloWorld = function(){
// everything in this space is private and only accessible in the HelloWorld block
// define some private variables
var dialog, showBtn;
// return a public interface
return {
init : function(){
showBtn = Ext.get('show-dialog-btn');
// attach to click event
showBtn.on('click', this.showDialog, this);
},
showDialog : function(){
if(!dialog){ // lazy initialize the dialog and only create it once
dialog = new Ext.BasicDialog("hello-dlg", {
autoTabs:true,
width:500,
height:300,
shadow:true,
minWidth:300,
minHeight:250,
proxyDrag: true
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Submit', dialog.hide, dialog).disable();
dialog.addButton('Close', dialog.hide, dialog);
}
dialog.show(showBtn.dom);
Ext.fly('myTextBox').focus();
}
};
}();
// using onDocumentReady instead of window.onload initializes the application
// when the DOM is ready, without waiting for images and other resources to load
Ext.onReady(HelloWorld.init, HelloWorld, true);
-- hello.html --
Hello World Dialog
This example shows how to create a very simple modal BasicDialog with "autoTabs".
Note that the js is not minified so it is readable. See hello.js for the full source code.
Here's snapshot of the code that creates the dialog:
dialog = new Ext.BasicDialog("hello-dlg", {
modal:true,
autoTabs:true,
width:500,
height:300,
shadow:true,
minWidth:300,
minHeight:300
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Close', dialog.hide, dialog);
dialog.addButton('Submit', dialog.hide, dialog).disable();
Hello Dialog
#If you have any other info about this subject , Please add it free.# |