问题标签 [dojo]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
5416 浏览

javascript - 无论如何禁用dojo日期文本框的客户端验证?

在下面的示例中,我使用的是dijit.form.DateTextBox

因此,例如,如果用户开始在日期中输入“asdf”,则该字段将变为黄色,并且会出现一个弹出错误消息说The value entered is not valid.. 即使我删除constraints="{datePattern:'MM/dd/yyyy'}"它仍然有效。

在不详细说明原因的情况下,我希望能够保留 dojoType 并在特定情况下仍然阻止验证。

0 投票
1 回答
3184 浏览

javascript - Event handling in Dojo

Taking Jeff Atwood's advice, I decided to use a JavaScript library for the very basic to-do list application I'm writing. I picked the Dojo toolkit, version 1.1.1. At first, all was fine: the drag-and-drop code I wrote worked first time, you can drag tasks on-screen to change their order of precedence, and each drag-and-drop operation calls an event handler that sends an AJAX call to the server to let it know that order has been changed.

Then I went to add in the email tracking functionality. Standard stuff: new incoming emails have a unique ID number attached to their subject line, all subsequent emails about that problem can be tracked by simply leaving that ID number in the subject when you reply. So, we have a list of open tasks, each with their own ID number, and each of those tasks has a time-ordered list of associated emails. I wanted the text of those emails to be available to the user as they were looking at their list of tasks, so I made each task box a Dijit "Tree" control - top level contains the task description, branches contain email dates, and a single "leaf" off of each of those branches contains the email text.

First problem: I wanted the tree view to be fully-collapsed by default. After searching Google quite extensively, I found a number of solutions, all of which seemed to be valid for previous versions of Dojo but not the one I was using. I eventually figured out that the best solution would seem to be to have a event handler called when the Tree control had loaded that simply collapsed each branch/leaf. Unfortunately, even though the Tree control had been instantiated and its "startup" event handler called, the branches and leaves still hadn't loaded (the data was still being loaded via an AJAX call). So, I modified the system so that all email text and Tree structure is added server-side. This means the whole fully-populated Tree control is available when its startup event handler is called.

So, the startup event handler fully collapses the tree. Next, I couldn't find a "proper" way to have nice formatted text for the email leaves. I can put the email text in the leaf just fine, but any HTML gets escaped out and shows up in the web page. Cue more rummaging around Dojo's documentation (tends to be out of date, with code and examples for pre-1.0 versions) and Google. I eventually came up with the solution of getting JavaScript to go and read the SPAN element that's inside each leaf node and un-escape the escaped HTML code in it's innerHTML. I figured I'd put code to do this in with the fully-collapse-the-tree code, in the Tree control's startup event handler.

However... it turns out that the SPAN element isn't actually created until the user clicks on the expando (the little "+" symbol in a tree view you click to expand a node). Okay, fair enough - I'll add the re-formatting code to the onExpand() event handler, or whatever it's called. Which doesn't seem to exist. I've searched to documentation, I've searched Google... I'm quite possibly mis-understanding Dojo's "publish/subscribe" event handling system, but I think that mainly because there doesn't seem to be any comprehensive documentation for it anywhere (like, where do I find out what events I can subscribe to?).

So, in the end, the best solution I can come up with is to add an onClick event handler (not a "Dojo" event, but a plain JavaScript event that Dojo knows nothing about) to the expando node of each Tree branch that re-formats the HTML inside the SPAN element of each leaf. Except... when that is called, the SPAN element still doesn't exist (sometimes - other times it's been cached, just to further confuse you). Therefore, I have the event handler set up a timer that periodically calls a function that checks to see if the relevant SPAN element has turned up yet before then re-formatting it.

The above has the feel of a truly horrible hack, and I feel sure I must have taken a wrong turn somewhere early on in my thought process. Can someone please tell me:

  • The correct way to go about putting nicely-formatted text inside a Dojo/Dijit Tree control.
  • The correct way to handle Dojo events, like where I can figure out what events are available for me to subscribe to.
  • A better JavaScript library to use (can I do what I want to with JQuery and avoid the all-around-the-houses approach seen above?).

PS: If you're naming a software project, give thought to its name's uniqueness in Google - I'm sure searching for "Dojo" documentation in Google would be easier without all the martial arts results getting in the way.

PPS: Firefox spellchecker knows how to spell "Atwood", correcting me when I put two 'T's instead of one. Is Jeff just that famous now?

0 投票
6 回答
2657 浏览

javascript - dojo dijit.form.ValidationTextBox 的问题

以下 XHTML 代码不起作用:

在 Firebug 中,我收到以下错误消息:

[异常...“组件返回失败代码:0x80004003(NS_ERROR_INVALID_POINTER)[nsIDOMNSHTMLElement.innerHTML]”nsresult:“0x80004003(NS_ERROR_INVALID_POINTER)”位置:“JS 框架 :: http://localhost:21000/dojotoolkit/dojo/dojo。 js :: 匿名 :: 第 319 行”数据:无] http://localhost:21000/dojotoolkit/dojo/dojo.js第 319 行

知道有什么问题吗?

0 投票
3 回答
5487 浏览

javascript - 使用 IE 和 SSL 编写 Dojo

我的应用程序在仅 SSL 的网站上使用Dojo 1.1.1 。它目前正在利用和一个.dijit.ProgressBardijit.form.DateTextBox

在Firefox 2 & 3中一切正常,但只要我在IE7中尝试相同的脚本,结果就是一个烦人的安全信息对话框:

此页面包含安全和非安全项目。是否要显示非安全项目?

我已经仔细检查了该页面是否有任何非 HTTPS引用无济于事。它似乎是特定于dojo.js. 曾经有过设置为空的iframe故障src,但现在似乎已修复(在查看源代码时)。

还有其他人有这个问题吗?让Dojo在仅 SSL 的Web 服务器上与IE配合使用的最佳实践是什么?

0 投票
4 回答
1265 浏览

dojo - Google 托管的 dojox.gfx

我正在使用以下 html 从 Google 的主机加载 dojo。

这个错误出现在 requre 行,并带有类似 dojox.gfx 的错误未定义。有没有办法使这项工作,或者谷歌不支持 dojox 扩展?

或者,是否有另一个我可以用于标准 dojo 版本的通用主机?

0 投票
8 回答
7643 浏览

javascript - GWT 或 DOJO 还是其他?

我来自微软世界(而且我很平静)。我想快速制作一个 Web 应用程序的原型,如果它成功了,就让它生效——我不想使用 ASP.Net。

我不确定要使用哪个 Web 应用程序工具包。我应该使用 GWT、DOJO ......其他建议吗?我对任何服务器端语言持开放态度,但我正在研究 RoR、Php 甚至 Java(准确地说是 J2EE)。我不是一个 Javascript/CSS 的人,所以一个可以让我在这些方面相对容易的工具包会更可取。

另外,我是家里的mac用户。您推荐的框架有哪些 IDE?

有什么建议吗?

0 投票
1 回答
466 浏览

java - 将 Shrinksafe 与 IBM JRE 一起使用时出现 MalformedInputException

在尝试使用 Shrinksafe custom_rhino.jar 构建 Dojo 时,我得到了 MalformedInputException。当构建到达包含以 UTF-8 存储的法语字母的自定义小部件/模板时,就会出现问题。AIX 机器的 LANG=en_US 应该是正确的,根据其他记录在案的有关 IBM JRE 的 MalformedInputException 的问题来判断。

切换到 Sun 的 JRE 是不可接受的解决方案,因为此构建必须在 IBM AIX 上运行。解决方案可能是更改 AIX 中的某些内容或更改 IBM JRE 中的设置或两者兼而有之。到目前为止,我一直没有成功。

dojo 论坛中也描述了问题,但没有适当的解决方案。

0 投票
1 回答
1281 浏览

layout - 使用 DojoX Layout,是否可以替换布局的内容?

我有一个 div,其中使用 DojoX 布局功能加载了一个页面:

是否有一个 API 可以用来稍后将这个 div 的内容替换为来自另一个页面的其他内容(其他 URI)?

亚历克斯

0 投票
2 回答
900 浏览

dojo - Dojo DnD 接受外部对象

是否可以编写 Dojo DnD 目标以接受外部对象,例如来自文件资源管理器的文件或文件夹?例如,Windows 资源管理器。

0 投票
3 回答
707 浏览

asp.net - 使用 flashplayer 对话框批量上传文件

我目前正在寻找允许人们一次选择多个文件以批量上传图像的方法。我正在为我的 ASP.NET Web 应用程序评估这些选项:

我倾向于 YUI,因为文档很清晰,而且我基本上已经编写了 Flajaxian 提供的文件上传器和缩略图,javascript 看起来也更紧凑。我什至无法开始评估 Dojo,因为我不清楚如何从 PHP 示例中获取与 .NET 集成的部分。

有没有人在这些方面有过非常好的或非常糟糕的经历?