0

我一直在努力让 Dijit.form.DateTextBox 在 div 内工作。我发现如果我将“claro”类应用于 body 标签,它会正常工作。虽然,我不希望 claro 类覆盖我的其他样式。此外,由于 MVC,我无法访问我所有页面上的 body 标签。

这是我所拥有的:

<html>
   <head>
        <style type="text/css">
          body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
        </style>
        <script src="dojo/dojo.js"
        djConfig="parseOnLoad: true">
        </script>
        <script type="text/javascript">
            dojo.require("dijit.form.DateTextBox");
            dojo.require("dijit.layout.ContentPane");

        </script>
        <link rel="stylesheet" type="text/css" href="dijit/themes/claro/claro.css"
        />
    </head>

<body>
<table>
    <tr>
    <td>
        <div dojoType="dijit.layout.ContentPane" class="claro">
            <input type="text" name="date1" id="date1" value="2005-12-30" dojoType="dijit.form.DateTextBox" />
        </div>
    </td>
    <td>
        <div dojoType="dijit.layout.ContentPane" class="claro">
            <input type="text" name="date2" id="date2" value="2005-12-30" dojoType="dijit.form.DateTextBox" />
        </div>
    </td>
    </tr>
</table>
</body>
</html>
4

2 回答 2

0

发生这种情况是因为默认情况下所有 dojo 弹出窗口都附加到 BODY(奇怪)。

我找到了解决办法。只需将 tundra/calendar.css 复制到 calendarFix.css 并从中删除所有 .tundra 或 .claro 引用。例如,考虑这个片段:

:   
.tundra .dijitCalendarDecrease {
 background-position: top left;
} 
.tundra .dijitCalendarIncrease {
 background-position: -30px top;
}
.tundra .dijitCalendarContainer {
 font-size: 100%;
 border-spacing: 0;
 border-collapse: separate;
 border: 1px solid #ccc;
 margin: 0;
}
:

:   
.dijitCalendarDecrease {
 background-position: top left;
} 
.dijitCalendarIncrease {
 background-position: -30px top;
}
.dijitCalendarContainer {
 font-size: 100%;
 border-spacing: 0;
 border-collapse: separate;
 border: 1px solid #ccc;
 margin: 0;
}
:
于 2011-10-05T20:21:49.980 回答
0

只是让他实现了 jQueryUI 附带的日历功能。它更直接。我认为 Dojo 更像是一个应用程序框架,而不仅仅是为网页使用某些小部件。

于 2010-12-09T14:49:12.617 回答