Loading ...
Sorry, an error occurred while loading the content.

RE: [ydn-javascript] A couple of bugs (?) - treeview and dialog - from a noob

Expand Messages
  • Steven Peterson
    Gaetano, Let me try to take a stab at your Dialog questions. It appears that your markup for the Dialog is not constructed properly. You have to construct your
    Message 1 of 3 , Dec 1, 2006
    View Source
    • 0 Attachment

      Gaetano,

       

      Let me try to take a stab at your Dialog questions.

       

      It appears that your markup for the Dialog is not constructed properly. You have to construct your pre-existing markup in Standard Module Format, which looks like this:

       

      <div id="element1">

        <div class="hd"></div>

        <div class="bd"></div>

        <div class="ft"></div>

      </div>

       

      In your case, since you’re building a Dialog, your markup should look like this:

       

      <div id="element1">

        <div class="bd">

          <form>…</form>

        </div>

      </div>

       

      If you build your markup properly, the Dialog will instantiate correctly and you should be good to go. Please let me know if you have any further problems. Thanks for the feedback!

       

       

      Steven Peterson

      Web Developer, Platform Engineering

      Yahoo!

       

       

       

       

      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Gaetano Giunta
      Sent: Friday, December 01, 2006 2:06 AM
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] A couple of bugs (?) - treeview and dialog - from a noob

       

      Hello everybody.


      2 - dialogs: I spent a lot of time figuring out that when the constructor for a dialog is called, the html element whose id is passed to the constructor has to be present in the document body.

      Doing this:

      file.js:
      var myDlg = new Dialog('element1', {etc...});

      file.html
      <script src="file.js"></script>
      <body onload="myDlg.render(); myDlg.show()">
      <div id="element1"><form>...</form></div>

      will have quite a bit of undesirable side-effects:
      - element1 does not get hidden and is rendered on the page 'as is' (in fact myDlg does not "stick" to it)
      - when calling myDlg.show() a js error is triggered on "this.body.innerHTML" not found (in YAHOO.widget.Dialog.prototype.registerForm)

      I understand this might be a constraint imposed by the overall scheme of things, but it is documented nowhere...
      Shall I file a bug for it?

      More generally speaking, the whole lib is jam-packed with methods and events that cross correlate in subtle ways, and it is quite hard (to me, at least) to figure out 'who does what, when'... Maybe a tutorial/intro section about
      - what happens on obj creation
      - what happens on obj render
      - what happens on obj show
      - what methods should be called to redraw/rebuild/modify objects
      could be of use, not only to the casual user, but also to the lib coder / extender...


      Bye
      Gaetano

    • Gaetano Giunta
      Thanks for answering, but the markup for the dialog I had used was correct (it was taken striaght off the lib examples). The fault with the original posting is
      Message 2 of 3 , Dec 4, 2006
      View Source
      • 0 Attachment
        Thanks for answering, but the markup for the dialog I had used was correct (it was taken striaght off the lib examples).
         
        The fault with the original posting is mine: when I posted to the mailing list I had not my laptop with me, and I did not want to spend too much time rewriting/testing all the code, so I did it by memory, "summarizing" a bit.
         
        Anyway, the point is: if you build the dialog object before inserting its html tag in document.body, a js error will be raised (an the div element will not be hidden...).
         
        I worked around it by creating the dialog div as strictly empty in the page html, and filling it with the appropriate html via javascript, just before creating the dialog oject.
         
        Bye
        Gaetano
         
         
        -----Original Message-----
        From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com]On Behalf Of Steven Peterson
        Sent: Friday, December 01, 2006 7:56 PM
        To: ydn-javascript@yahoogroups.com
        Subject: RE: [ydn-javascript] A couple of bugs (?) - treeview and dialog - from a noob

        Gaetano,

        Let me try to take a stab at your Dialog questions.

        It appears that your markup for the Dialog is not constructed properly. You have to construct your pre-existing markup in Standard Module Format, which looks like this:

        <div id="element1">

          <div class="hd"></div>

          <div class="bd"></div>

          <div class="ft"></div>

        </div>

        In your case, since you’re building a Dialog, your markup should look like this:

        <div id="element1">

          <div class="bd">

            <form>…</form>

          </div>

        </div>

        If you build your markup properly, the Dialog will instantiate correctly and you should be good to go. Please let me know if you have any further problems. Thanks for the feedback!

        Steven Peterson

        Web Developer, Platform Engineering

        Yahoo!

        From: ydn-javascript@ yahoogroups. com [mailto:ydn- javascript@ yahoogroups. com] On Behalf Of Gaetano Giunta
        Sent: Friday, December 01, 2006 2:06 AM
        To: ydn-javascript@ yahoogroups. com
        Subject: [ydn-javascript] A couple of bugs (?) - treeview and dialog - from a noob

        Hello everybody.


        2 - dialogs: I spent a lot of time figuring out that when the constructor for a dialog is called, the html element whose id is passed to the constructor has to be present in the document body.

        Doing this:

        file.js:
        var myDlg = new Dialog('element1' , {etc...});

        file.html
        <script src="file.js"></script>
        <body onload="myDlg.render( ); myDlg.show()">
        <div id="element1"><form>...</form></div>

        will have quite a bit of undesirable side-effects:
        - element1 does not get hidden and is rendered on the page 'as is' (in fact myDlg does not "stick" to it)
        - when calling myDlg.show() a js error is triggered on "this.body.innerHTML" not found (in YAHOO.widget. Dialog.prototype .registerForm)

        I understand this might be a constraint imposed by the overall scheme of things, but it is documented nowhere...
        Shall I file a bug for it?

        More generally speaking, the whole lib is jam-packed with methods and events that cross correlate in subtle ways, and it is quite hard (to me, at least) to figure out 'who does what, when'... Maybe a tutorial/intro section about
        - what happens on obj creation
        - what happens on obj render
        - what happens on obj show
        - what methods should be called to redraw/rebuild/ modify objects
        could be of use, not only to the casual user, but also to the lib coder / extender...


        Bye
        Gaetano

      Your message has been successfully submitted and would be delivered to recipients shortly.