Hybrid View
-
17 Nov 2006 2:06 PM #1
YUI Logger and Basic Dialog
YUI Logger and Basic Dialog
Originally, using borderlayout, I had my logger set a seperate tab to the main body of my pages, so I could switch back and forth to it. I decided I didn't like this, and instead, wanted to put the logger into a basic dialog so I could open and close it on demand. It wasn't that hard, and I learned how to set a global variable inside a function

Javascript
HTML to place in your page to trigger showing the dialogCode:YAHOO.util.myLogger = { init: function() { window.myLoggerDialog = null;; loggerDialog = document.createElement('div'); loggerDialog.id = 'loggerDialog'; loggerDialog.style.visibility = 'hidden'; document.body.appendChild(loggerDialog); myLoggerDialog = new YAHOO.ext.BasicDialog("loggerDialog", { modal:false, autoTabs:true, width:500, height:300, shadow:true, minWidth:300, minHeight:300 }); myLoggerDialog.header.update('Logger'); loggerTabs = new YAHOO.ext.TabPanel(myLoggerDialog.body.dom); loggerTab = loggerTabs.addTab('logger', 'Logger'); myLoggerDialog.tabs = loggerTabs; myLoggerDialog.tabs.activate('logger'); var myLogReader = new YAHOO.widget.LogReader("logger"); } }; YAHOO.ext.EventManager.onDocumentReady(YAHOO.util.myLogger.init, YAHOO.util.myLogger, true);
Code:<span onClick='myLoggerDialog.show(this);'>Logger</span>
-
17 Nov 2006 2:23 PM #2
You could streamline this further. Creating a BasicDialog will build the internal div (hd, bd, ft) and add the css classes also. Basically all you have to do is pass the div that will contain the dialog (e.g. loggerDialog in your case)
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
17 Nov 2006 2:41 PM #3
Your 100% correct, and as such, I've updated the block of code

-
17 Nov 2006 8:40 PM #4
Can someone give me an example link to this? It sounds sweet.

-
18 Nov 2006 12:02 AM #5
http://whasit.com/ci/
Actually, there you can see a bug in it too.. until you resize the logger box, it won't show a tabbar in the content panel?
-
18 Nov 2006 2:57 AM #6
Don't you want to wrap the logger?
-
18 Nov 2006 4:35 AM #7
ok, that post was made when I was still half asleep...
actually the logger does wrap.. after you resize the dialog it's in. Maybe I need a repaint or something after I insert the logger into the tab?
-
18 Nov 2006 12:23 PM #8
Ah that's a lot better. Now it's time to clean up that text and buttons hehe. I might actually use it myself. I am sick of alerting everything.

-
18 Nov 2006 2:45 PM #9
if you end up with a better one, let me know
I'm playing around trying to integrate drupal 5 beta and yui-ext 
-
24 Nov 2006 10:39 AM #10
I've updated my version to use layoutdialog cutting down a few lines of code. I also finally figured out a fix for the body of the dialog not displaying correctly until after a resize.
Code:YAHOO.util.myLogger = { init: function() { window.myLoggerDialog = null; loggerDialog = document.createElement('div'); loggerDialog.id = 'loggerDialog'; loggerDialog.style.visibility = 'hidden'; document.body.appendChild(loggerDialog); myLoggerDialog = new YAHOO.ext.LayoutDialog("loggerDialog", { modal:false, autoScroll:true, width:500, height:300, shadow:true, minWidth:500, minHeight:300, center: { autoScroll:true, alwaysShowTabs: false } }); var layout = myLoggerDialog.getLayout(); myLoggerDialog.beginUpdate(); var loggerPane = layout.add('center', new YAHOO.ext.ContentPanel('logger', { fitToFrame: true, autoCreate: true })); myLoggerDialog.endUpdate(); myLoggerDialog.header.update('Logger'); var myLogReader = new YAHOO.widget.LogReader("logger"); myLoggerDialog.syncBodyHeight(); } }; YAHOO.ext.EventManager.onDocumentReady(YAHOO.util.myLogger.init, YAHOO.util.myLogger, true);
Similar Threads
-
basic dialog
By Alidad in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 21 Nov 2008, 7:22 AM -
Need Help In Basic Dialog
By tagfrisk in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 1 May 2007, 11:28 PM -
basic dialog basic question
By kevinknight in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 13 Mar 2007, 10:58 AM -
Basic Dialog, is this possible....
By peter_n in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 22 Dec 2006, 1:40 PM -
help with Basic Dialog!
By VatsaL in forum Ext 1.x: Help & DiscussionReplies: 4Last Post: 2 Dec 2006, 2:50 PM


Reply With Quote