function showLoading(){ var dom = require("dojo/dom"); var loading = dom.byId('loadingMessage'); if (loading == null) return; dom.byId('loadingMessage').style.display=''; hideLoading(); }
function loadMobilePanel(panelTagId,url){ var dom = require("dojo/dom"); var parser = require("dojox/mobile/parser"); var container = dom.byId(panelTagId); // do not load panels twice if (container.innerHTML != "Loading..."){ return; } var parent = container.parentNode; var xhr = require("dojo/request/xhr"); xhr.get(url, { handleAs : "text", headers: { "Accept": "text/html;type=ajax" } }).then(function(data){ container.innerHTML = data; try{ parser.parse(container); } catch(e){ // ignore parsing errors } }, function(e){ alert(e); }); }
/** * A separate AJAX post method for mobile then doAjaxPost mostly since uses *.innerHTML to update to DOM and run parse while doAjaxPost uses dijit.set("content",...) * @param formName The form name to submit in AJAX * @param areaName Tag id to update with the AJAX response (Partial Page Rendering) * @param actionName Host action alias name. If null, standard submit (ENTER) will be performed * @param fragments Server side part to render. Handled by AjaxTilesView in Spring Web MVC file */ function doMobilePost(formName, areaName, actionName,fragments) { showLoading(); var dom = require("dojo/dom"); var parser = require("dojox/mobile/parser"); var domConstruct = require("dojo/dom-construct"); var form = dom.byId(formName); var container = null; var title = null; if (areaName != null) { container = dom.byId(areaName); } form.action = form.action + "?partial=1"; if (fragments != null){ form.action = form.action + "&fragments=" + fragments; } if (actionName != null && actionName.length > 0) { form.action = form.action + "&action=" + actionName; } var domForm = require("dojo/dom-form"); var xhr = require("dojo/request/xhr"); xhr.post(form.action, { handleAs : "text", data: domForm.toObject(formName), headers: { "Accept": "text/html;type=ajax" } }).then(function(data){ var container = dom.byId("bodyContainer"); container.innerHTML = data; try{ parser.parse(container); } catch(e){ // ignore parsing errors } hideLoading(); }, function(e){ alert(e); }); }
}).then(function(data){ var container = dom.byId("bodyContainer"); container.innerHTML = data; try{ parser.parse(container); } catch(e){ // ignore parsing errors } hideLoading(); }, function(e){
/** * Submit the given <entityName>Form in ajax post, and loads the result into the * given entity name panel * * @param entityName * @param actionName */ function doAjaxPost(formName, areaName, actionName,fragments,callback) { showLoading(); var dom = require("dojo/dom"); var dijit = require("dijit/registry"); var domForm = require("dojo/dom-form"); var form = dom.byId(formName); var container = null; var title = null; if (areaName != null) { container = dijit.byId(areaName); if (container != null){ title = container.get('title'); } } form.action = form.action + "?partial=1"; if (fragments != null){ form.action = form.action + "&fragments=" + fragments; } if (actionName != null && actionName.length > 0) { form.action = form.action + "&action=" + actionName; } var xhr = require("dojo/request/xhr"); xhr.post(form.action, { data: domForm.toObject(formName), handleAs : "text", headers: { "Accept": "text/html;type=ajax" } }).then(function(data){ if (container != null) { if (title != null){ container.set('title', title); } container.set('content', data); if (callback != null){ callback.call(); } } }, function(e){ alert(e); }); if (container != null) { container.set('title', 'Updating...'); } }
var SingleQuery = require('./for-dgrid-demos/SingleQuery'); // Once the response is received, build an in-memory store with the data var store = new RequestMemory({ target: 'example-resources/hof-batting.json' }); // Create an instance of OnDemandGrid referencing the store var grid = window.grid = new (declare([ Grid, SingleQuery ]))({ className: 'dgrid-autoheight', collection: store, sort: 'last', // Initialize sort on last name, ascending columns: { first: 'First Name', last: 'Last Name', totalG: 'Games Played' } }, 'grid'); on(dom.byId('queryForm'), 'submit', function(event) { event.preventDefault(); grid.set('collection', store.filter({ // Pass a RegExp to Memory's filter method // Note: this code does not go out of its way to escape // characters that have special meaning in RegExps last: new RegExp(this.elements.last.value, 'i') })); }); on(dom.byId('queryForm'), 'reset', function() { // Reset the collection when the form is reset grid.set('collection', store); });
var store = new RequestMemory({ target: 'example-resources/hof-batting.json' }); // Create an instance of OnDemandGrid referencing the store var grid = window.grid = new OnDemandGrid({ collection: store, sort: 'last', // Initialize sort on last name, ascending columns: { first: 'First Name', last: 'Last Name', totalG: 'Games Played' } }, 'grid'); grid.startup(); on(dom.byId('queryForm'), 'submit', function(event) { event.preventDefault(); grid.set('collection', store.filter({ // Pass a RegExp to Memory's filter method // Note: this code does not go out of its way to escape // characters that have special meaning in RegExps last: new RegExp(this.elements.last.value, 'i') })); }); on(dom.byId('queryForm'), 'reset', function() { // Reset the query when the form is reset grid.set('collection', store); }); on(dom.byId('sortLastAsc'), 'click', function() {
function enableSpotlight() { let html = "<div id='spotlight' class='spotlight'></div>"; domConstruct.place(html, dom.byId("map_container"), "first"); }
import dom from "dojo/dom"; import domConstruct from "dojo/dom-construct"; import query from "dojo/query"; import Color from "dojo/_base/Color"; let map = new Map("map", { basemap: "topo", center: [-117.19, 34.055], zoom: 15 }); let search = new Search({ map }, dom.byId("search")); let extent = new Extent({ "spatialReference": { "wkid": 102100 }, "xmin": -13063280, "xmax": -13033928, "ymin": 4028345, "ymax": 4042715 }); search.sources[0].searchExtent = extent; search.startup();
window.setTimeout(function() {dom.byId('loadingMessage').style.display='none';},300);
import dojoquery from "dojo/query" import domStyle from "dojo/dom-style" function random() { let text = ""; let possible = "abcdefghijklmnopqrstuvwxyz0123456789"; for (var i = 0; i < 5; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; }; let connId = random(); let socket = io.connect(); dom.byId("connectionId").innerHTML = "<h3>"+connId+"</h3>"; let connectionData = {room: connId, type: "computer"}; socket.emit('create', connectionData); let speed = 0.01; let currentScreenCoord = []; socket.on('message', function(data) { console.log("received message from server"+ data.message['x']) }); socket.on('alldeviceconnected', function(data){ if(data == "true"){//if phone connection is successful, remove top bar // mapMod.pan(); domStyle.set("connectionDiv", "display", "none");