dojo

Setting the value (selected option) of a dijit.form.Select widget

…衆ロ難τιáo~ 提交于 2019-11-30 08:46:49
I have a dijit.form.Select widget. It's tied to a data store, if that matters. It's filled with several options already. All I want to do is programmatically set its value. I can get its value using myWidget.attr('value') but if I try to do myWidget.attr('value', 5) for example (where 5 is one of the valid values), all it does is reset the widget to select the very first option, no matter what value I give it. This seems to be a bug, and there aren't any tests or documentation which show how to accomplish what I want to. But is there some way, even if it's a dirty hack? I'm using Dojo 1.4.0.

What does Dojo consider a XHR request error?

廉价感情. 提交于 2019-11-30 08:37:19
问题 When doing AJAX through Dojo we can pass two callbacks, one to execute after a successfull request and one to execute after an error: dojo.xhr("GET",{ url: myURL, content: messageContents, load: function(returnData, ioArgs){ //This is called on success }, error: function(returnData, ioArgs){ //This is called on failure } }); I couldn't find in the documentation what is defined as an error . I'd guess anything with a return code >= 400 but I'm not sure. 回答1: Generally speaking, an unsuccessful

How to build Dojo into a single file, given a list of dependencies?

时间秒杀一切 提交于 2019-11-30 06:56:33
I have a simple Dojo application, that does only one require call, loading all the dependencies. The trouble is, while it is extremely simple, it still ends up loading ~100 files from server. I tried to solve that problem using Dojo build system, but seems I don't have a deep enough understanding. So my question is - given a list of dependencies, like the following: ["dojo/parser", "dijit/registry", "dojo/dom", "dojo/on", "dojo/query", "dojo/dom-class", "dojo/request", "dijit/form/ValidationTextBox", "dijit/form/Select", "dijit/form/NumberSpinner", "dijit/form/CheckBox", "dijit/layout

How do I debug my asynchronous, promise based code if the library is swallowing all the exceptions?

懵懂的女人 提交于 2019-11-30 06:44:36
The Problem JSFiddle : http://jsfiddle.net/missingno/Gz8Pe/2/ I have some code that looks like this: var d = new Deferred(); d.resolve(17); return d.then(function(){ //do some stuff... }) .then(function(){ var obj = a_funtion_that_returns_null_on_IE(); var x = obj.some_property; //BOOM! }); The problem is that when I am on IE all I can see are 'obj' is null or not an object errors, without any reference to the corresponding line number and without the debugger halting at the offending line (like I wish it would). This kind of issue is making the code a pain to debug and the only solutions I

vue地图可视化 ArcGIS篇

本秂侑毒 提交于 2019-11-30 05:36:31
ArcGIS for javascript开发心得 本次实例中采用ArcGIS for javascript3.24版本,由于版本3与4在API等存在较大区别,就不一一列举,详细区别看 官方解释 arcgis for js4.7版本能够自动创建layer、graphs等类,而不像3.24版本需要在图形渲染前重新new 新的类。然而,查找大量文件资料,网上有关ArcGIS forjavascript的资料甚少,更不用说通过vueJS+arcGIS开发出一套可视化平台,在不断查看官方文档和实际操作,总结自己的构思和使用心得。 技术采用: vueJS + vuetify + axios + arcGIS3.24 + echarts 如图所示:可视化界面采用三层三文治结构,从server(后台,非online server)读取数据,vueJS负责数据驱动,ArcGIS与echarts负责数据的图形化。同时引入浏览器的web sql db本地数据库进行海量数据缓存 ArcGIS API for Javascript 是由美国 Esri 公司推出, 基于 dojo框架和 REST 格式的一套编程接口(目前最新版本为 3.3, dojo1.8。 通过 ArcGIS API for Javascript可以对 ArcGIS for Server 进行访问调用,并将 ArcGIS for

Detect whether postMessage can send objects?

南楼画角 提交于 2019-11-30 05:20:01
I'm looking for a neat way to detect whether postMessage in the browser supports the sending and receiving of objects or just strings. I figure that someone out there must have wrote something that does this but I have not managed to find a solution. I'm using postMessage to send data to/from a WebWorker. Whilst detecting whether the browser supports workers is straight-forward, detecting whether objects can be send via postMessage has proved more difficult. I'd like to write a simple detection function. So, if the browser supports the sending of objects to use that. If only strings are

Difference between programmatically vs declaratively created widgets in dojo?

混江龙づ霸主 提交于 2019-11-30 04:32:42
问题 I know in dojo we can create any widgets in two ways, programmatically declaratively To create widgets programmatically we'll use JavaScript, whereas for declaratively we'll use dojo attributes in HTML tags. Can someone explain me what are the differences between them? which one is mostly preferred and why? 回答1: Difference Well, there are certain differences between both ways. In the declarative way, all configuration is based upon HTML attributes like dojo-data-props but also some other

Automatically Resize dojo dijit.Grid widget when it's parent container resizes

自闭症网瘾萝莉.ら 提交于 2019-11-30 04:02:09
问题 I have a dojo Grid widget inside a TitlePane with it's width set to 100%. The TitlePane is in a liquid layout so it's width changes with the browser window size. The problem I am having is that when the parent window expands (or contracts) the grid itself does not change it's width. I can get it to resize itself by calling render() on the grid, but how can I detect that the parent window has resized so that I know to redraw the grid widget? 回答1: I've had to do this on occasion; it's not too

ArcGIS API for Javascript 2.X 离线部署(以2.6为例)

半腔热情 提交于 2019-11-30 00:32:19
1. 先在官网上ArcGIS API for JavaScript download page(需要有账户)下载最新的API:arcgis_js_v26_api.zip( 点击直接下载 )和 SDK: arcgis_js_v26_sdk.zip( 直接下载 ); 2. 将下载下来的 arcgis_js_v26_api.zip 和 arcgis_js_v26_sdk.zip 分别解压,将各自文件夹下的的 arcgis_js_api 文件夹拷贝到 C:\inetpub\wwwroot 下,因为拷贝的文件夹名称都为arcgis_js_api,因此当拷贝第二个文件夹时选择覆盖即可; 3. 将 C:\inetpub\wwwroot\arcgis_js_api\library\2.6\jsapi\js\esri 下的 esri.js 文件 C:\inetpub\wwwroot\arcgis_js_api\library\2.6\jsapi\js\dojo\dojo 下的 dojo.xd.js 及 dojo.xd.js.uncompressed.js 两个文件 中的 "[HOSTNAME_AND_PATH_TO_JSAPI] 替换为 djConfig.url + "/arcgis_js_api/library/2.6/jsapi/ (注意别少了冒号) 同理将 C:\inetpub\wwwroot

How to redirect with JQuery, load another page but sent some POST parameters in request?

ε祈祈猫儿з 提交于 2019-11-29 21:26:08
问题 How do I redirect using either JQuery, DOJO or plain JavaScript, load another page but sent some POST parameters in request? 回答1: This should work, but i haven't tested it: function postData(url, data) { var form = $('<form></form>'); $(form).hide().attr('method','post').attr('action',url); for (i in data) { var input = $('<input type="hidden" />').attr('name',i).val(data[i]); $(form).append(input); } $(form).appendTo('body').submit(); } Basically you can create a form on the fly and submit