Search the web
Sign In
New User? Sign Up
ydn-javascript · Yahoo! User Interface Library Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Panel cfg object, setting properties query   Message List  
Reply | Forward Message #38800 of 52127 |
Re: [ydn-javascript] Panel cfg object, setting properties query

One way to do it would be like this:

SGP.panel.ModalRounded = function(title,oConfig) {

SGP.panel.ModalRounded.superclass.constructor.call(
this,
'sgp_panel_modal',
{
width:oConfig.width || "600px",
fixedcenter: oConfig.fixedcenter !== false,

And so on for the rest. You set the panel with the option coming from
the extra argument oConfig and if there is none (undefined hence false)
it will take your default. With fixedcenter you have to do it in
another way since false is a valid setting so you set it to true if
fixedcenter is anything but exactly false.

Satyam

stuplum wrote:
> Hi All,
>
> I'm trying to build my own versions of Panels, that I can re-use (as
> much for practice than actual pratical reasons at the moment).
>
> I've got this code so far:
>
> In a Global JS file:
>
> var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, Panel =
> YAHOO.widget.Panel;
> var BASE_IMG_MEDIA_URL = 'Content/Images';
>
> /*
> Set up some global SGP panels
> */
> // create SGP.panel namespace
> .namespace(["pa nel"]);
>
> // Modal Panel with title.
> SGP.panel.ModalRounded = function(title) {
>
> SGP.panel.ModalRounded.superclass.constructor.call(
> this,
> 'sgp_panel_modal',
> {
> width: "600px",
> fixedcenter: true,
> constraintoviewport: false,
> underlay: "none",
> modal: true,
> close: true,
> visible: false,
> draggable: true
> }
> ; );
>
> this.setHeader('<div class="tl"></div><span>' + title +
> '</span><div class="tr"></div>');
> this.setBody('<img class="panel-waiting" src="' +
> BASE_IMG_MEDIA_URL + '/trans.gif" alt="waiting..." />');
> this.setFooter('<div class="bl"></div><span
> class="button-group"><a id="sgp_panel_modal_cancel" href="javascript:
> void(0)">cancel</a> | <button
> id="sgp_panel_modal_save">Save</button></span><div class="br"></div>');
> this.render(document.body);
> };
> if(Panel) {
> YAHOO.lang.extend(SGP.panel.ModalRounded, Panel);
> };
>
> In a Page specific JS file:
>
> ...
>
> open_preview: function(ev) {
> var _onlinePreviewPanel;
> if (!_onlinePreviewPanel) {
> _onlinePreviewPanel = new
> LOOT.panel.ModalRounded(this.config.modal_box_title,
> {
> width: '900px'
> }
> );
> };
> // set body to what html were after
> _onlinePreviewPanel.setBody(this.html);
> _onlinePreviewPanel.cfg.setProperty("width", "900px", true);
> // show th e modal box
> _onlinePreviewPanel.show();
> }
>
> ...
>
>
> As you can see, I extend the YAHOO panel to my own setting default
> properties, however I want to be able to overide these properties. The
> 'open_preview' function tries to overide the width property, in 2
> ways, both don't work, what am I missing.
>
> Regards
>
> Stuart
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.173 / Virus Database: 270.7.6/1709 - Release Date: 05/10/2008
9:20
>
>



Mon Oct 6, 2008 3:19 pm

satyamutsa
Offline Offline
Send Email Send Email

Forward
Message #38800 of 52127 |
Expand Messages Author Sort by Date

Hi All, I'm trying to build my own versions of Panels, that I can re-use (as much for practice than actual pratical reasons at the moment). I've got this code...
stuplum
Offline Send Email
Oct 6, 2008
11:38 am

One way to do it would be like this: SGP.panel.ModalRounded = function(title,oConfig) { SGP.panel.ModalRounded.superclass.constructor.call( this, ...
Satyam
satyamutsa
Offline Send Email
Oct 6, 2008
3:19 pm

Awesome, i thought it would be something like that, but wasn't sure, Big thanks. Stuart ... class="br"></div>'); ... true); ... The ... 05/10/2008 9:20...
stuplum
Offline Send Email
Oct 6, 2008
3:39 pm

Actually, now that I think of it, this is not complete. It allows you to set only those options which have defaults, but does not allow you to set other...
Satyam
satyamutsa
Offline Send Email
Oct 6, 2008
5:28 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help