dojo

How to properly generate exceptions in PHP/Dojo when returning javascript code

北城余情 提交于 2019-11-27 08:22:25
问题 I am having difficulty understanding how exceptions are handled when code is fetched dynamically via AJAX and executed via eval . With clientside javascript, it is rather simple, if I have a piece of code such as this var j = 'some string'; j.propA.x++; this will raise an exception because propA , which is of type undefined does not have an x . Furthermore, the exception raised is very easy to understand. Now lets put the above code in a text file, lets call it test.js , and store it on the

Set download path

假装没事ソ 提交于 2019-11-27 07:49:14
问题 I have a web application that receives a simple text file, but I need this file to be downloaded to a specific path. Meaning, when the application receives a text file, it will always be downloaded to a specific folder (for example, to C:\MyFolder). If it isn't possible, then I need to copy the file from where user has chosen to my folder. This application is based on JavaScript. 回答1: JavaScript cannot exert any control over my (the visitor's) local filesystem. I remain in complete control of

Dojo grid nested json

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 07:24:33
问题 I'd like to have a dojo grid which connects to a server url which outputs the following json : {identifier : "id" items : [ { id: "1", name: "John", university : { name: "XXX", address: "YYY" } }]. Basically I have a nested json. I would like to represent the university name and University address as separate columns in the grid. I tried using the dojox.grid.DataGrid object and creating a gird layout, but do not know how to refer to the nested elments and university.name and university

Does Dojo have an equivalent to jQuery.trigger()?

一世执手 提交于 2019-11-27 06:42:56
问题 In jQuery, you can do this: $('#myElement').trigger('change'); How do I do that in Dojo? 回答1: I don't think Dojo has similar functionality, at least as not as far as I know / can find. But you can use code like the following to replicate this functionality: dojo.addOnLoad(function() { var button = dojo.byId("myButton"); dojo.connect(button, "onclick", function() { alert("Clicked!"); }); // IE does things differently if (dojo.isIE) { button.fireEvent("onclick"); } else { // Not IE var event =

Worklight core-web-layer.js errors

纵然是瞬间 提交于 2019-11-27 05:41:45
Can someone help me? When I run my Worklight project on Chrome, Firefox or Opera I don't get any errors. But when I run it on IE I get these errors: Error: multipleDefine Error: multipleDefine Error: multipleDefine Error: multipleDefine SCRIPT5002: Function expected core-web-layer.js, line 311 character 160 SCRIPT438: Object doesn't support property or method '_eventHandler' core-web-layer.js, line 165 character 71 When I run it on Android, the Dojo functionality also doesn't work and I get this error: 07-09 13:12:37.817: D/CordovaLog(7180): Error: scriptError 07-09 13:12:37.817: E/Web Console

How to copy a DOM node with event listeners?

*爱你&永不变心* 提交于 2019-11-27 04:34:57
I tried node.cloneNode(true); // deep copy It doesn't seem to copy the event listeners that I added using node.addEventListener("click", someFunc); . We use the Dojo library. cloneNode() does not copy event listeners. In fact, there's no way of getting hold of event listeners via the DOM once they've been attached, so your options are: Add all the event listeners manually to your cloned node Refactor your code to use event delegation so that all event handlers are attached to a node that contains both the original and the clone Use a wrapper function around Node.addEventListener() to keep

What is the Dojo equivalent to jQuery .live()?

六眼飞鱼酱① 提交于 2019-11-27 03:54:35
问题 What is the Dojo equivalent to jQuery .live()? http://api.jquery.com/live/ The only solution I found was to dojo.disconnect the event handlers and re-connect them once a dynamic piece of markup was added to the page. 回答1: usage and demo dojo.query("body").delegate(selector, eventName, fn); code - rewrites the original mixin-like delegate function of dojo dojo.provide("dojox.NodeList.delegate"); dojo.require("dojo.NodeList-traverse"); dojo.extend(dojo.NodeList, { delegate: function ( selector

ajax call in jsf 2.0 (myfaces), the onevent Javascript function in the ajax tag gets called before the rendering is complete

北战南征 提交于 2019-11-27 03:25:30
问题 This is my first time asking a question on a forum, since usually my questions have already been asked and answered. I haven't found an answer to this problem that works for me, so here goes: I'm making an Ajax call in JSF 2.0 like this: < f :ajax listener="#{myReferenceController.clearRequiredReferenceNumber}" onevent="resetFocus" execute="@form" render=":resultsForm:ResultsDisplay" /> Everything in the listener works perfectly, and the data is then rendered as expected in the data table

IBM Worklight 6.0 - Unable to run sample hybrid worklight app using dojo toolkit for android environment on avd?

爱⌒轻易说出口 提交于 2019-11-27 02:26:26
I have developed a sample hybrid application using worklight 6.0 and dojo toolkit 1.9 for android environment2.2 . When i tested this application on simulator it works fine. But when i tried it on AVD or on actual device, it runs but displays a blank screen only. Can't understand what to do to make it work on actual device properly? When i tried it to run on AVD i noticed following list of errors: 07-08 19:51:22.462: I/dalvikvm(664): Could not find method org.apache.cordova.CordovaWebView.setOverScrollMode, referenced from method org.apache.cordova.DroidGap.init 07-08 19:51:22.462: W/dalvikvm

Dojo Dialog with confirmation button

僤鯓⒐⒋嵵緔 提交于 2019-11-27 00:47:53
问题 I would like to add a generic dialog with "Ok" and "Cancel" buttons support callback functions. How can I achieve this with a Dojo AMD? For example: myDialog = new Dialog ({ title: "My Dialog", content: "Are you sure, you want to delete the selected Record?", style: "width: 300px", onExecute:function(){ //Callback function console.log("Record Deleted") }, onCancel:function(){ console.log("Event Cancelled") } }); // create a button to clear the cart new Button({ label:"Ok" onClick: myDialog