dijit.form.Button baseClass problem...

View: New views
4 Messages — Rating Filter:   Alert me  

dijit.form.Button baseClass problem...

by paulsr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings:

I am very new to Dojo, so I suspect this question has a simple answer.

In the following piece of code, my button (plusButton) which is created near the end of the code, is displayed correctly:

--------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE></TITLE>

   <style type="text/css">
      @import "../dojo/resources/dojo.css";
      @import "../dijit/themes/nihilo/nihilo.css";
   </style>
   <LINK REL="stylesheet" HREF="../j4_styles/main.css" TYPE="text/css" MEDIA="all">

   <script type="text/javascript"
       src="../dojo/dojo.js" djConfig="parseOnLoad: true">
   </script>

   <script type="text/javascript">
      dojo.require("dojo.parser");
      dojo.require("dijit.Menu");
      dojo.require("dijit.form.Button");
      dojo.require("dijit.form.Form");
      dojo.require("dijit.Dialog");
   </script>

   <style type="text/css">
       body, html { width:100%; height:100%; margin:0; padding:0 }
       #borderContainerMain { width: 100%; height: 100%; }
   </style>

<script type="text/javascript">

function getNextNews() {
  dojo.xhrGet({
    url: "./test_dijit_2.mv",
    load: function(response, ioArgs){
      dojo.byId("test_dijit").innerHTML = response;
      return response;
    },
    error: function(response, ioArgs){
      dojo.byId("test_dijit").innerHTML =
        "An error occurred, with response: " + response;
      return response;
    },
    handleAs: "text"
  });
}
</script>

</head>

<!-- & BODY -->
<body class="nihilo">

<div id="test_dijit">
click me -
<button dojoType="dijit.form.Button" onclick="getNextNews();" baseClass="plusButton" showLabel="false";></button>
</div>

</body>
</html>

-----------------

The relevant CSS is:

-----------------

.plusButton .dijitButtonNode {
   width: 27px !important;
   height: 18px !important;
   margin: 0px !important;
   padding: 0px !important;
   background: url(../j4_pix/buttons/plus.jpg) repeat-x bottom !important;
}

------------------

but when I click the button to load test_dijit_2.mv, the new button is not displayed at all.  The contents of test_dijit_2.mv are as follows:

---------------------

should be a new button -
<button dojoType="dijit.form.Button" baseClass="plusButton" onclick="" showLabel="false";></button>

---------------------

Since I am using the same baseClass setting, I assumed the button would be displayed correctly.  What am I missing here.

Many tkx for any help...

--paul

Re: dijit.form.Button baseClass problem...

by Bill Keese-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nothing to do w/baseClass, it's because the parser isn't running on your new loaded HTML.  You could call the parser directly (dojo.parser.parse(...)) specifying the new node to parse, or alternately use dijit.layout.ContentPane or the utility classes in dojo.html.ContentSetter (IIRC) that also will call the parser for you.

On Sun, Nov 8, 2009 at 12:07 PM, paulsr <paul@...> wrote:

Greetings:

I am very new to Dojo, so I suspect this question has a simple answer.

In the following piece of code, my button (plusButton) which is created near
the end of the code, is displayed correctly:

--------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE></TITLE>

  <style type="text/css">
     @import "../dojo/resources/dojo.css";
     @import "../dijit/themes/nihilo/nihilo.css";
  </style>
  <LINK REL="stylesheet" HREF="../j4_styles/main.css" TYPE="text/css"
MEDIA="all">

  <script type="text/javascript"
      src="../dojo/dojo.js" djConfig="parseOnLoad: true">
  </script>

  <script type="text/javascript">
     dojo.require("dojo.parser");
     dojo.require("dijit.Menu");
     dojo.require("dijit.form.Button");
     dojo.require("dijit.form.Form");
     dojo.require("dijit.Dialog");
  </script>

  <style type="text/css">
      body, html { width:100%; height:100%; margin:0; padding:0 }
      #borderContainerMain { width: 100%; height: 100%; }
  </style>

<script type="text/javascript">

function getNextNews() {
 dojo.xhrGet({
   url: "./test_dijit_2.mv",
   load: function(response, ioArgs){
     dojo.byId("test_dijit").innerHTML = response;
     return response;
   },
   error: function(response, ioArgs){
     dojo.byId("test_dijit").innerHTML =
       "An error occurred, with response: " + response;
     return response;
   },
   handleAs: "text"
 });
}
</script>

</head>

<!-- & BODY -->
<body class="nihilo">

<div id="test_dijit">
click me -
<button dojoType="dijit.form.Button" onclick="getNextNews();"
baseClass="plusButton" showLabel="false";></button>
</div>

</body>
</html>

-----------------

The relevant CSS is:

-----------------

.plusButton .dijitButtonNode {
  width: 27px !important;
  height: 18px !important;
  margin: 0px !important;
  padding: 0px !important;
  background: url(../j4_pix/buttons/plus.jpg) repeat-x bottom !important;
}

------------------

but when I click the button to load test_dijit_2.mv, the new button is not
displayed at all.  The contents of test_dijit_2.mv are as follows:

---------------------

should be a new button -
<button dojoType="dijit.form.Button" baseClass="plusButton" onclick=""
showLabel="false";></button>

---------------------

Since I am using the same baseClass setting, I assumed the button would be
displayed correctly.  What am I missing here.

Many tkx for any help...

--paul

--
View this message in context: http://old.nabble.com/dijit.form.Button-baseClass-problem...-tp26240888p26240888.html
Sent from the Dojo mailing list archive at Nabble.com.

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: dijit.form.Button baseClass problem...

by paulsr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bill Keese-2 wrote:
Nothing to do w/baseClass, it's because the parser isn't running on your new
loaded HTML.  You could call the parser directly (dojo.parser.parse(...))
specifying the new node to parse, or alternately use
dijit.layout.ContentPane or the utility classes in dojo.html.ContentSetter
(IIRC) that also will call the parser for you.
Many thanks Bill.  All fixed now.

--paul


Re: dijit.form.Button baseClass problem...

by paulsr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

paulsr wrote:
Many thanks Bill.  All fixed now.
Oops, I wrote too soon.  In my small test example, having added the line

      dojo.parser.parse("test_dijit");

the button now displays.

But in my real-world code, which is somewhat longer and more complex, only the first of many buttons displays.

If I return to the small test script which I posted, and I add more buttons, they all display.  However; my real code contains Miva script, and I'm surmising that this is causing problems.  Maybe timing related.  Not sure.

I have tried adding sync: true; but this made no difference.

Does anyone have experience of Miva with dojo?  Can anyone offer advice on how to get the called script to parse correctly?

TIA

--paul