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

Re: [ydn-javascript] 'hello world' datatable not being displayed

Expand Messages
  • Satyam
    That error often signals that you have not loaded all the library files, that you didn t load them in order or even that you loaded one more than once and the
    Message 1 of 6 , Oct 1, 2008
    • 0 Attachment
      That error often signals that you have not loaded all the library files,
      that you didn't load them in order or even that you loaded one more than
      once and the second time it overstepped on something already initialized.

      Use the configurator to check you have all that's needed:

      http://developer.yahoo.com/yui/articles/hosting/#configure

      Satyam


      hewsonism wrote:
      > Hello all,
      >
      > I am new to javascript and YUI. I have tried to figure this out on my
      > own, but have not had any luck.
      >
      > I have a web application that consists of essentially a menu and a div
      > to display content based on what menu item is selected from the menu.
      > When a menu item is selected the below is event handler is called.
      >
      > I make a simple query to the server, the server replies with a JSON
      > string and depending on the contents of that string I fill the display
      > div (called 'content-paine').
      >
      > For singleton data I call displaySingletonData(), this is working
      > correctly, conversely I can not for the life of me figure out why the
      > table will not display.
      >
      > Orginally the table display code was not wrapped in a listener, this
      > resulted in firebug complaining that YAHOO.widget.DataTable was not a
      > constructor. From another post in this group, I found that the page
      > elements might not have been loaded yet and that was creating the
      > situation. After wrapping the code I do not get any errors, but nothing
      > is displayed either. Perhaps the 'load' event is not happening and so
      > the datatable code is never called?
      >
      > Any suggestions / comments are welcome.
      >
      > Thanks,
      >
      > Steve
      >
      >
      >
      > **** begin function ****
      > function setContentPaine (eventType, fireMethodArgs, contentObj) {
      >
      > var handleSuccess = function (responseObj) {
      >
      > //attempt to parse the returned JSON string
      > try{
      > messages = YAHOO.lang.JSON.parse(responseObj.responseText);
      > }
      > catch (err) {
      > setErrorDisplay('','', { info: "Could not parse response from
      > server." });
      > return;
      > }
      >
      > // look @ the returned data, its displayed differently depending on
      > // whether or not the object is a singleton or not.
      > if (messages.data.singleton == true) {
      > displaySingletonData(messages.data);
      > } else {
      >
      > YAHOO.util.Event.addListener(window, "load", function() {
      > YAHOO.example.Basic = new function() {
      > var bookorders = [
      > {id:"po-0167", date:new Date(1980, 2, 24), quantity:1,
      > amount:4, title:"A Book About Nothing"},
      > {id:"po-0783", date:new Date("January 3, 1983"),
      > quantity:null, amount:12.12345, title:"The Meaning of Life"},
      > {id:"po-0297", date:new Date(1978, 11, 12),
      > quantity:12, amount:1.25, title:"This Book Was Meant to Be Read Aloud"},
      > {id:"po-1482", date:new Date("March 11, 1985"),
      > quantity:6, amount:3.5, title:"Read Me Twice"}
      > ];
      > var myColumnDefs =
      > [{key:"id"},{key:"date"},{key:"quantity"},{key:"amount"},{key:"title"}];
      > this.myDataSource = new YAHOO.util.DataSource(bookorders);
      > this.myDataSource.responseType =
      > YAHOO.util.DataSource.TYPE_JSARRAY;
      > this.myDataSource.responseSchema = {fields:
      > ["id","date","quantity","amount","title"]};
      >
      > this.myDataTable = new
      > YAHOO.widget.DataTable("content-paine",
      > myColumnDefs, this.myDataSource);
      > };
      > });
      > }
      > }
      >
      > var handleFailure = function (responseObj) {
      > setErrorDisplay("","", {info: responseObj.statusText});
      > }
      >
      > var callbackObj = { success: handleSuccess, failure: handleFailure,
      > argument:{} };
      >
      > var sUrl = "../content.py";
      > var postData = "pageid="+contentObj.pageId;
      > var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,
      > callbackObj, postData);
      >
      > }
      > **** end function ****
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.169 / Virus Database: 270.7.5/1702 - Release Date: 01/10/2008 9:05
      >
      >
    • Eric Miraglia
      A direct link to the Configurator prepopulated with DataTable s dependencies, including optional dependencies:
      Message 2 of 6 , Oct 1, 2008
      • 0 Attachment
        A direct link to the Configurator prepopulated with DataTable's dependencies, including optional dependencies:


        Regards,
        Eric


        On Oct 1, 2008, at 11:08 AM, Satyam wrote:

        That error often signals that you have not loaded all the library files, 
        that you didn't load them in order or even that you loaded one more than 
        once and the second time it overstepped on something already initialized. 

        Use the configurator to check you have all that's needed:

        http://developer. yahoo.com/ yui/articles/ hosting/# configure

        Satyam

        hewsonism wrote:
        > Hello all,
        >
        > I am new to javascript and YUI. I have tried to figure this out on my
        > own, but have not had any luck.
        >
        > I have a web application that consists of essentially a menu and a div
        > to display content based on what menu item is selected from the menu. 
        > When a menu item is selected the below is event handler is called.
        >
        > I make a simple query to the server, the server replies with a JSON
        > string and depending on the contents of that string I fill the display
        > div (called 'content-paine' ).
        >
        > For singleton data I call displaySingletonDat a(), this is working
        > correctly, conversely I can not for the life of me figure out why the
        > table will not display.
        >
        > Orginally the table display code was not wrapped in a listener, this
        > resulted in firebug complaining that YAHOO.widget. DataTable was not a
        > constructor. From another post in this group, I found that the page
        > elements might not have been loaded yet and that was creating the
        > situation. After wrapping the code I do not get any errors, but nothing
        > is displayed either. Perhaps the 'load' event is not happening and so
        > the datatable code is never called?
        >
        > Any suggestions / comments are welcome.
        >
        > Thanks,
        >
        > Steve
        >
        >
        >
        > **** begin function ****
        > function setContentPaine (eventType, fireMethodArgs, contentObj) {
        >
        > var handleSuccess = function (responseObj) {
        >
        > //attempt to parse the returned JSON string
        > try{
        > messages = YAHOO.lang.JSON. parse(responseOb j.responseText) ;
        > }
        > catch (err) {
        > setErrorDisplay( '','', { info: "Could not parse response from
        > server." });
        > return;
        > }
        >
        > // look @ the returned data, its displayed differently depending on
        > // whether or not the object is a singleton or not.
        > if (messages.data. singleton == true) {
        > displaySingletonDat a(messages. data);
        > } else {
        >
        > YAHOO.util.Event. addListener( window, "load", function() {
        > YAHOO.example. Basic = new function() {
        > var bookorders = [
        > {id:"po-0167" , date:new Date(1980, 2, 24), quantity:1,
        > amount:4, title:"A Book About Nothing"},
        > {id:"po-0783" , date:new Date("January 3, 1983"),
        > quantity:null, amount:12.12345, title:"The Meaning of Life"},
        > {id:"po-0297" , date:new Date(1978, 11, 12),
        > quantity:12, amount:1.25, title:"This Book Was Meant to Be Read Aloud"},
        > {id:"po-1482" , date:new Date("March 11, 1985"),
        > quantity:6, amount:3.5, title:"Read Me Twice"}
        > ];
        > var myColumnDefs =
        > [{key:"id"}, {key:"date" },{key:"quantity "},{key:" amount"}, {key:"title" }];
        > this.myDataSource = new YAHOO.util.DataSour ce(bookorders) ;
        > this.myDataSource. responseType =
        > YAHOO.util.DataSour ce.TYPE_JSARRAY;
        > this.myDataSource. responseSchema = {fields:
        > ["id","date" ,"quantity" ,"amount" ,"title"] };
        >
        > this.myDataTable = new
        > YAHOO.widget. DataTable( "content- paine",
        > myColumnDefs, this.myDataSource) ;
        > };
        > });
        > }
        > }
        >
        > var handleFailure = function (responseObj) {
        > setErrorDisplay( "","", {info: responseObj. statusText} );
        > }
        >
        > var callbackObj = { success: handleSuccess, failure: handleFailure,
        > argument:{} };
        >
        > var sUrl = "../content. py";
        > var postData = "pageid="+contentOb j.pageId;
        > var request = YAHOO.util.Connect. asyncRequest( 'POST', sUrl,
        > callbackObj, postData);
        >
        > }
        > **** end function ****
        >
        >
        >
        > ------------ --------- --------- ------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------ --------- --------- --------- --------- --------- -
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - http://www.avg. com 
        > Version: 8.0.169 / Virus Database: 270.7.5/1702 - Release Date: 01/10/2008 9:05
        >
        > 


      • hewsonism
        Thank you for the replies. I have gone to the configurator and my code now uses the suggested order & dependencies-
        Message 3 of 6 , Oct 2, 2008
        • 0 Attachment
          Thank you for the replies.

          I have gone to the configurator and my code now uses the suggested order
          & dependencies->
          http://developer.yahoo.com/yui/articles/hosting/?animation&connection&da\
          tasource&datatable&dom&element&event&fonts&grids&json&menu&reset&yahoo&M\
          IN&nocombine

          I am still not seeing any table displayed, nor am I seeing any errors in
          firebug.

          Any other suggestions?

          Thanks,

          Steve

          --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...>
          wrote:
          >
          > A direct link to the Configurator prepopulated with DataTable's
          > dependencies, including optional dependencies:
          >
          >
          http://developer.yahoo.com/yui/articles/hosting/?datatable&MIN&loadOptio\
          nal
          >
          > Regards,
          > Eric
          >
          >
          > On Oct 1, 2008, at 11:08 AM, Satyam wrote:
          >
          > > That error often signals that you have not loaded all the library
          > > files,
          > > that you didn't load them in order or even that you loaded one more
          > > than
          > > once and the second time it overstepped on something already
          > > initialized.
          > >
          > > Use the configurator to check you have all that's needed:
          > >
          > > http://developer.yahoo.com/yui/articles/hosting/#configure
          > >
          > > Satyam
          > >
          > > hewsonism wrote:
          > > > Hello all,
          > > >
          > > > I am new to javascript and YUI. I have tried to figure this out on
          > > my
          > > > own, but have not had any luck.
          > > >
          > > > I have a web application that consists of essentially a menu and a
          > > div
          > > > to display content based on what menu item is selected from the
          > > menu.
          > > > When a menu item is selected the below is event handler is called.
          > > >
          > > > I make a simple query to the server, the server replies with a
          JSON
          > > > string and depending on the contents of that string I fill the
          > > display
          > > > div (called 'content-paine').
          > > >
          > > > For singleton data I call displaySingletonData(), this is working
          > > > correctly, conversely I can not for the life of me figure out why
          > > the
          > > > table will not display.
          > > >
          > > > Orginally the table display code was not wrapped in a listener,
          this
          > > > resulted in firebug complaining that YAHOO.widget.DataTable was
          > > not a
          > > > constructor. From another post in this group, I found that the
          page
          > > > elements might not have been loaded yet and that was creating the
          > > > situation. After wrapping the code I do not get any errors, but
          > > nothing
          > > > is displayed either. Perhaps the 'load' event is not happening and
          > > so
          > > > the datatable code is never called?
          > > >
          > > > Any suggestions / comments are welcome.
          > > >
          > > > Thanks,
          > > >
          > > > Steve
          > > >
          > > >
          > > >
          > > > **** begin function ****
          > > > function setContentPaine (eventType, fireMethodArgs, contentObj) {
          > > >
          > > > var handleSuccess = function (responseObj) {
          > > >
          > > > //attempt to parse the returned JSON string
          > > > try{
          > > > messages = YAHOO.lang.JSON.parse(responseObj.responseText);
          > > > }
          > > > catch (err) {
          > > > setErrorDisplay('','', { info: "Could not parse response from
          > > > server." });
          > > > return;
          > > > }
          > > >
          > > > // look @ the returned data, its displayed differently depending
          on
          > > > // whether or not the object is a singleton or not.
          > > > if (messages.data.singleton == true) {
          > > > displaySingletonData(messages.data);
          > > > } else {
          > > >
          > > > YAHOO.util.Event.addListener(window, "load", function() {
          > > > YAHOO.example.Basic = new function() {
          > > > var bookorders = [
          > > > {id:"po-0167", date:new Date(1980, 2, 24), quantity:1,
          > > > amount:4, title:"A Book About Nothing"},
          > > > {id:"po-0783", date:new Date("January 3, 1983"),
          > > > quantity:null, amount:12.12345, title:"The Meaning of Life"},
          > > > {id:"po-0297", date:new Date(1978, 11, 12),
          > > > quantity:12, amount:1.25, title:"This Book Was Meant to Be Read
          > > Aloud"},
          > > > {id:"po-1482", date:new Date("March 11, 1985"),
          > > > quantity:6, amount:3.5, title:"Read Me Twice"}
          > > > ];
          > > > var myColumnDefs =
          > > > [{key:"id"},{key:"date"},{key:"quantity"},{key:"amount"},
          > > {key:"title"}];
          > > > this.myDataSource = new YAHOO.util.DataSource(bookorders);
          > > > this.myDataSource.responseType =
          > > > YAHOO.util.DataSource.TYPE_JSARRAY;
          > > > this.myDataSource.responseSchema = {fields:
          > > > ["id","date","quantity","amount","title"]};
          > > >
          > > > this.myDataTable = new
          > > > YAHOO.widget.DataTable("content-paine",
          > > > myColumnDefs, this.myDataSource);
          > > > };
          > > > });
          > > > }
          > > > }
          > > >
          > > > var handleFailure = function (responseObj) {
          > > > setErrorDisplay("","", {info: responseObj.statusText});
          > > > }
          > > >
          > > > var callbackObj = { success: handleSuccess, failure:
          handleFailure,
          > > > argument:{} };
          > > >
          > > > var sUrl = "../content.py";
          > > > var postData = "pageid="+contentObj.pageId;
          > > > var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,
          > > > callbackObj, postData);
          > > >
          > > > }
          > > > **** end function ****
          > > >
          > > >
          > > >
          > > > ------------------------------------
          > > >
          > > > Yahoo! Groups Links
          > > >
          > > >
          > > >
          > > > ----------------------------------------------------------
          > > >
          > > >
          > > > No virus found in this incoming message.
          > > > Checked by AVG - http://www.avg.com
          > > > Version: 8.0.169 / Virus Database: 270.7.5/1702 - Release Date:
          > > 01/10/2008 9:05
          > > >
          > > >
          > >
          > >
          >
        • Satyam
          You know that the link below is not the one that loads the library files but it is a reference to the configuration. Just checking. Satyam
          Message 4 of 6 , Oct 2, 2008
          • 0 Attachment
            You know that the link below is not the one that loads the library files
            but it is a reference to the configuration. Just checking.

            Satyam

            hewsonism wrote:
            > Thank you for the replies.
            >
            > I have gone to the configurator and my code now uses the suggested order
            > & dependencies->
            > http://developer.yahoo.com/yui/articles/hosting/?animation&connection&datasource&datatable&dom&element&event&fonts&grids&json&menu&reset&yahoo&MIN&nocombine
            >
            > I am still not seeing any table displayed, nor am I seeing any errors in
            > firebug.
            >
            > Any other suggestions?
            >
            > Thanks,
            >
            > Steve
            >
            > --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...>
            > wrote:
            >
            >> A direct link to the Configurator prepopulated with DataTable's
            >> dependencies, including optional dependencies:
            >>
            >>
            >>
            > http://developer.yahoo.com/yui/articles/hosting/?datatable&MIN&loadOptio\
            > nal
            >
            >> Regards,
            >> Eric
            >>
            >>
            >> On Oct 1, 2008, at 11:08 AM, Satyam wrote:
            >>
            >>
            >>> That error often signals that you have not loaded all the library
            >>> files,
            >>> that you didn't load them in order or even that you loaded one more
            >>> than
            >>> once and the second time it overstepped on something already
            >>> initialized.
            >>>
            >>> Use the configurator to check you have all that's needed:
            >>>
            >>> http://developer.yahoo.com/yui/articles/hosting/#configure
            >>>
            >>> Satyam
            >>>
            >>> hewsonism wrote:
            >>>
            >>>> Hello all,
            >>>>
            >>>> I am new to javascript and YUI. I have tried to figure this out on
            >>>>
            >>> my
            >>>
            >>>> own, but have not had any luck.
            >>>>
            >>>> I have a web application that consists of essentially a menu and a
            >>>>
            >>> div
            >>>
            >>>> to display content based on what menu item is selected from the
            >>>>
            >>> menu.
            >>>
            >>>> When a menu item is selected the below is event handler is called.
            >>>>
            >>>> I make a simple query to the server, the server replies with a
            >>>>
            > JSON
            >
            >>>> string and depending on the contents of that string I fill the
            >>>>
            >>> display
            >>>
            >>>> div (called 'content-paine').
            >>>>
            >>>> For singleton data I call displaySingletonData(), this is working
            >>>> correctly, conversely I can not for the life of me figure out why
            >>>>
            >>> the
            >>>
            >>>> table will not display.
            >>>>
            >>>> Orginally the table display code was not wrapped in a listener,
            >>>>
            > this
            >
            >>>> resulted in firebug complaining that YAHOO.widget.DataTable was
            >>>>
            >>> not a
            >>>
            >>>> constructor. From another post in this group, I found that the
            >>>>
            > page
            >
            >>>> elements might not have been loaded yet and that was creating the
            >>>> situation. After wrapping the code I do not get any errors, but
            >>>>
            >>> nothing
            >>>
            >>>> is displayed either. Perhaps the 'load' event is not happening and
            >>>>
            >>> so
            >>>
            >>>> the datatable code is never called?
            >>>>
            >>>> Any suggestions / comments are welcome.
            >>>>
            >>>> Thanks,
            >>>>
            >>>> Steve
            >>>>
            >>>>
            >>>>
            >>>> **** begin function ****
            >>>> function setContentPaine (eventType, fireMethodArgs, contentObj) {
            >>>>
            >>>> var handleSuccess = function (responseObj) {
            >>>>
            >>>> //attempt to parse the returned JSON string
            >>>> try{
            >>>> messages = YAHOO.lang.JSON.parse(responseObj.responseText);
            >>>> }
            >>>> catch (err) {
            >>>> setErrorDisplay('','', { info: "Could not parse response from
            >>>> server." });
            >>>> return;
            >>>> }
            >>>>
            >>>> // look @ the returned data, its displayed differently depending
            >>>>
            > on
            >
            >>>> // whether or not the object is a singleton or not.
            >>>> if (messages.data.singleton == true) {
            >>>> displaySingletonData(messages.data);
            >>>> } else {
            >>>>
            >>>> YAHOO.util.Event.addListener(window, "load", function() {
            >>>> YAHOO.example.Basic = new function() {
            >>>> var bookorders = [
            >>>> {id:"po-0167", date:new Date(1980, 2, 24), quantity:1,
            >>>> amount:4, title:"A Book About Nothing"},
            >>>> {id:"po-0783", date:new Date("January 3, 1983"),
            >>>> quantity:null, amount:12.12345, title:"The Meaning of Life"},
            >>>> {id:"po-0297", date:new Date(1978, 11, 12),
            >>>> quantity:12, amount:1.25, title:"This Book Was Meant to Be Read
            >>>>
            >>> Aloud"},
            >>>
            >>>> {id:"po-1482", date:new Date("March 11, 1985"),
            >>>> quantity:6, amount:3.5, title:"Read Me Twice"}
            >>>> ];
            >>>> var myColumnDefs =
            >>>> [{key:"id"},{key:"date"},{key:"quantity"},{key:"amount"},
            >>>>
            >>> {key:"title"}];
            >>>
            >>>> this.myDataSource = new YAHOO.util.DataSource(bookorders);
            >>>> this.myDataSource.responseType =
            >>>> YAHOO.util.DataSource.TYPE_JSARRAY;
            >>>> this.myDataSource.responseSchema = {fields:
            >>>> ["id","date","quantity","amount","title"]};
            >>>>
            >>>> this.myDataTable = new
            >>>> YAHOO.widget.DataTable("content-paine",
            >>>> myColumnDefs, this.myDataSource);
            >>>> };
            >>>> });
            >>>> }
            >>>> }
            >>>>
            >>>> var handleFailure = function (responseObj) {
            >>>> setErrorDisplay("","", {info: responseObj.statusText});
            >>>> }
            >>>>
            >>>> var callbackObj = { success: handleSuccess, failure:
            >>>>
            > handleFailure,
            >
            >>>> argument:{} };
            >>>>
            >>>> var sUrl = "../content.py";
            >>>> var postData = "pageid="+contentObj.pageId;
            >>>> var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,
            >>>> callbackObj, postData);
            >>>>
            >>>> }
            >>>> **** end function ****
            >>>>
            >>>>
            >>>>
            >>>> ------------------------------------
            >>>>
            >>>> Yahoo! Groups Links
            >>>>
            >>>>
            >>>>
            >>>> ----------------------------------------------------------
            >>>>
            >>>>
            >>>> No virus found in this incoming message.
            >>>> Checked by AVG - http://www.avg.com
            >>>> Version: 8.0.169 / Virus Database: 270.7.5/1702 - Release Date:
            >>>>
            >>> 01/10/2008 9:05
            >>>
            >>>>
            >>>
            >
            >
            >
            > ------------------------------------
            >
            > Yahoo! Groups Links
            >
            >
            >
            > ------------------------------------------------------------------------
            >
            >
            > No virus found in this incoming message.
            > Checked by AVG - http://www.avg.com
            > Version: 8.0.173 / Virus Database: 270.7.5/1703 - Release Date: 02/10/2008 7:46
            >
            >
          • hewsonism
            I think the root of my problem was the load event had passed before I had added the listener. (my table is added to the content-paine div, but the page is
            Message 5 of 6 , Oct 2, 2008
            • 0 Attachment
              I think the root of my problem was the 'load' event had passed before I
              had added the listener. (my table is added to the content-paine div,
              but the page is never reloaded)

              replacing the if/else statement inside the 'handleSuccess' function from
              my earlier code with following fixed my problem.

              Thanks again,

              Steve

              ** begin new if/else **
              if (messages.data.singleton == true) {
              displaySingletonData(messages.data);
              } else {

              var displayTable = function () {

              var bookorders = [
              ["po-0167", new Date(1980, 2, 24),1, 4, "A Book About
              Nothing"],
              ["po-0783", new Date("January 3, 1983"), null,
              12.12345, "The Meaning of Life"],
              ["po-0297", new Date(1978, 11, 12), 12, 1.25, "This
              Book Was Meant to Be Read Aloud"],
              ["po-1482", new Date("March 11, 1985"), 6,3.5, "Read
              Me Twice"]
              ];
              var myColumnDefs =
              [{key:"id"},{key:"date"},{key:"quantity"},{key:"amount"},{key:"title"}];
              var myDataSource = new YAHOO.util.DataSource(bookorders);
              myDataSource.responseType =
              YAHOO.util.DataSource.TYPE_JSARRAY;
              myDataSource.responseSchema = {fields:
              ["id","date","quantity","amount","title"]};

              myDataTable = new YAHOO.widget.DataTable("tablecontainer",
              myColumnDefs, myDataSource);


              };
              YAHOO.util.Event.onAvailable("tablecontainer", displayTable);
              $('content-paine').innerHTML = "<div id='tablecontainer'></div>";
              }
              }

              ** end new if/else **
              --- In ydn-javascript@yahoogroups.com, "hewsonism"
              <stephen.cattaneo@...> wrote:
              >
              > Thank you for the replies.
              >
              > I have gone to the configurator and my code now uses the suggested
              order
              > & dependencies->
              >
              http://developer.yahoo.com/yui/articles/hosting/?animation&connection&da\
              \
              >
              tasource&datatable&dom&element&event&fonts&grids&json&menu&reset&yahoo&M\
              \
              > IN&nocombine
              >
              > I am still not seeing any table displayed, nor am I seeing any errors
              in
              > firebug.
              >
              > Any other suggestions?
              >
              > Thanks,
              >
              > Steve
              >
              > --- In ydn-javascript@yahoogroups.com, Eric Miraglia miraglia@
              > wrote:
              > >
              > > A direct link to the Configurator prepopulated with DataTable's
              > > dependencies, including optional dependencies:
              > >
              > >
              >
              http://developer.yahoo.com/yui/articles/hosting/?datatable&MIN&loadOptio\
              \
              > nal
              > >
              > > Regards,
              > > Eric
              > >
              > >
              > > On Oct 1, 2008, at 11:08 AM, Satyam wrote:
              > >
              > > > That error often signals that you have not loaded all the library
              > > > files,
              > > > that you didn't load them in order or even that you loaded one
              more
              > > > than
              > > > once and the second time it overstepped on something already
              > > > initialized.
              > > >
              > > > Use the configurator to check you have all that's needed:
              > > >
              > > > http://developer.yahoo.com/yui/articles/hosting/#configure
              > > >
              > > > Satyam
              > > >
              > > > hewsonism wrote:
              > > > > Hello all,
              > > > >
              > > > > I am new to javascript and YUI. I have tried to figure this out
              on
              > > > my
              > > > > own, but have not had any luck.
              > > > >
              > > > > I have a web application that consists of essentially a menu and
              a
              > > > div
              > > > > to display content based on what menu item is selected from the
              > > > menu.
              > > > > When a menu item is selected the below is event handler is
              called.
              > > > >
              > > > > I make a simple query to the server, the server replies with a
              > JSON
              > > > > string and depending on the contents of that string I fill the
              > > > display
              > > > > div (called 'content-paine').
              > > > >
              > > > > For singleton data I call displaySingletonData(), this is
              working
              > > > > correctly, conversely I can not for the life of me figure out
              why
              > > > the
              > > > > table will not display.
              > > > >
              > > > > Orginally the table display code was not wrapped in a listener,
              > this
              > > > > resulted in firebug complaining that YAHOO.widget.DataTable was
              > > > not a
              > > > > constructor. From another post in this group, I found that the
              > page
              > > > > elements might not have been loaded yet and that was creating
              the
              > > > > situation. After wrapping the code I do not get any errors, but
              > > > nothing
              > > > > is displayed either. Perhaps the 'load' event is not happening
              and
              > > > so
              > > > > the datatable code is never called?
              > > > >
              > > > > Any suggestions / comments are welcome.
              > > > >
              > > > > Thanks,
              > > > >
              > > > > Steve
              > > > >
              > > > >
              > > > >
              > > > > **** begin function ****
              > > > > function setContentPaine (eventType, fireMethodArgs, contentObj)
              {
              > > > >
              > > > > var handleSuccess = function (responseObj) {
              > > > >
              > > > > //attempt to parse the returned JSON string
              > > > > try{
              > > > > messages = YAHOO.lang.JSON.parse(responseObj.responseText);
              > > > > }
              > > > > catch (err) {
              > > > > setErrorDisplay('','', { info: "Could not parse response from
              > > > > server." });
              > > > > return;
              > > > > }
              > > > >
              > > > > // look @ the returned data, its displayed differently depending
              > on
              > > > > // whether or not the object is a singleton or not.
              > > > > if (messages.data.singleton == true) {
              > > > > displaySingletonData(messages.data);
              > > > > } else {
              > > > >
              > > > > YAHOO.util.Event.addListener(window, "load", function() {
              > > > > YAHOO.example.Basic = new function() {
              > > > > var bookorders = [
              > > > > {id:"po-0167", date:new Date(1980, 2, 24), quantity:1,
              > > > > amount:4, title:"A Book About Nothing"},
              > > > > {id:"po-0783", date:new Date("January 3, 1983"),
              > > > > quantity:null, amount:12.12345, title:"The Meaning of Life"},
              > > > > {id:"po-0297", date:new Date(1978, 11, 12),
              > > > > quantity:12, amount:1.25, title:"This Book Was Meant to Be Read
              > > > Aloud"},
              > > > > {id:"po-1482", date:new Date("March 11, 1985"),
              > > > > quantity:6, amount:3.5, title:"Read Me Twice"}
              > > > > ];
              > > > > var myColumnDefs =
              > > > > [{key:"id"},{key:"date"},{key:"quantity"},{key:"amount"},
              > > > {key:"title"}];
              > > > > this.myDataSource = new YAHOO.util.DataSource(bookorders);
              > > > > this.myDataSource.responseType =
              > > > > YAHOO.util.DataSource.TYPE_JSARRAY;
              > > > > this.myDataSource.responseSchema = {fields:
              > > > > ["id","date","quantity","amount","title"]};
              > > > >
              > > > > this.myDataTable = new
              > > > > YAHOO.widget.DataTable("content-paine",
              > > > > myColumnDefs, this.myDataSource);
              > > > > };
              > > > > });
              > > > > }
              > > > > }
              > > > >
              > > > > var handleFailure = function (responseObj) {
              > > > > setErrorDisplay("","", {info: responseObj.statusText});
              > > > > }
              > > > >
              > > > > var callbackObj = { success: handleSuccess, failure:
              > handleFailure,
              > > > > argument:{} };
              > > > >
              > > > > var sUrl = "../content.py";
              > > > > var postData = "pageid="+contentObj.pageId;
              > > > > var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,
              > > > > callbackObj, postData);
              > > > >
              > > > > }
              > > > > **** end function ****
              > > > >
              > > > >
              > > > >
              > > > > ------------------------------------
              > > > >
              > > > > Yahoo! Groups Links
              > > > >
              > > > >
              > > > >
              > > > > ----------------------------------------------------------
              > > > >
              > > > >
              > > > > No virus found in this incoming message.
              > > > > Checked by AVG - http://www.avg.com
              > > > > Version: 8.0.169 / Virus Database: 270.7.5/1702 - Release Date:
              > > > 01/10/2008 9:05
              > > > >
              > > > >
              > > >
              > > >
              > >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.