View Full Version : ScrollToCaret equivalent for LayoutDialog?

14 Dec 2007, 9:35 AM
My method of using a LayoutDialog does not instantiate the dialog more than once (i.e. performs an "if(!dialog)" check so that the dialog is only created the first time it is opened) and the problem is I have to go through a process of resetting the dialog's embedded form/etc anytime the dialog is shown.. and one thing I can't find a method for is resetting the position of the scroll bar (the user may have scrolled down 50%, performed their work and closed the dialog, then opened the dialog again to perform new work only to find that the scroll bar was still at 50%).

I would just like something like ... [user clicked open dialog button] ... myLayoutDialog.ScrollToCaret(); ... myLayoutDialog.show()

Is there a way of doing this at least somewhat elegantly?

edit: Just ran into scrollTo within Ext.Element, but I'm having trouble getting it to work.

edit: I can't get anything with scrolling to work at all, here is an example of what's not working:

<!-- Add add document Dialog -->
<div id="dialog-add_document" style="visibility:hidden;">
<div class="x-dlg-hd">Add Document</div>
<div class="x-dlg-bd">
<div id="dialog-add_document-inner" class="x-layout-inactive-content">
<div id="form-add">
<center><font color=red>*</font> = Required Field</center>
dialog code
addDocumentDialog = new Ext.LayoutDialog('dialog-add_document', {
width: 480,
height: 302,
center: {
autoScroll: true,
tabPosition: 'top',
closeOnTab: true,
alwaysShowTabs: false

addDocumentDialog.addButton('Submit', SubmitAddDocument);
addDocumentDialog.addButton('Close', function() { addDocumentDialog.hide(); });

var addDocumentLayout = addDocumentDialog.getLayout();
addDocumentLayout.add('center', new Ext.ContentPanel('dialog-add_document-inner', {title: 'Add Document'}));
scrollbar test
Ext.get('dialog-add_document-inner').scrollTo("top", 20);
Whether it's dialog-add_document-inner or dialog-add_document (I was confused on which element was relevant, I assume inner, but neither work so I'm unsure) the alert returns 0.

14 Dec 2007, 12:50 PM
Any clues on this? I'm still having no luck..