How to use dojo - 10 common examples

To help you get started, we’ve selected a few dojo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dojo / dojo / testsDOH / data / readOnlyItemFileTestTemplates.js View on Github external
runTest: function(datastore, t){
			// summary:
			//		Simple test of the getFeatures function of the store
			// description:
			//		Simple test of the getFeatures function of the store
			var store = new datastore(tests.data.readOnlyItemFileTestTemplates.getTestData("countries"));

			var features = store.getFeatures();
			t.assertTrue(features["dojo.data.api.Read"] != null);
			t.assertTrue(features["dojo.data.api.Identity"] != null);
		}
	},
github dojo / dojo / testsDOH / data / ItemFileWriteStore.js View on Github external
function test_getFeatures(){
			// summary:
			//		Simple test of the getFeatures function of the store
			// description:
			//		Simple test of the getFeatures function of the store
			var store = new dojo.data.ItemFileWriteStore(tests.data.readOnlyItemFileTestTemplates.getTestData("countries"));

			var features = store.getFeatures();

			// make sure we have the expected features:
			doh.assertTrue(features["dojo.data.api.Read"] !== null);
			doh.assertTrue(features["dojo.data.api.Identity"] !== null);
			doh.assertTrue(features["dojo.data.api.Write"] !== null);
			doh.assertTrue(features["dojo.data.api.Notification"] !== null);
			doh.assertFalse(features["iggy"]);

			// and only the expected features:
			var count = 0;
			for(var i in features){
				doh.assertTrue((i === "dojo.data.api.Read" ||
					i === "dojo.data.api.Identity" ||
					i === "dojo.data.api.Write" ||
					i === "dojo.data.api.Notification"));
				count++;
			}
			doh.assertEqual(count, 4);
		},
		function testWriteAPI_setValue(){
github hpcc-systems / HPCC-Platform / esp / src / src / WsTopology.ts View on Github external
}).then(lang.hitch(this, function (response) {
                var data = [];
                if (lang.exists("TpLogFileResponse.LogData", response)) {
                    this.lastPage = response.TpLogFileResponse.LogData;
                    this.emit("pageLoaded", this.lastPage);
                    arrayUtil.forEach(response.TpLogFileResponse.LogData.split("\n"), function (item, idx) {
                        if (options.start === 0 || idx > 0) {
                            //  Throw away first line as it will probably only be a partial line  ---
                            var itemParts = item.split(" ");
                            var lineNo, date, time, pid, tid, details;
                            if (itemParts.length) lineNo = nextItem(itemParts);
                            if (itemParts.length) date = nextItem(itemParts);
                            if (itemParts.length) time = nextItem(itemParts);
                            if (itemParts.length) pid = nextItem(itemParts);
                            if (itemParts.length) tid = nextItem(itemParts);
                            if (itemParts.length) details = itemParts.join(" ");
                            data.push({
                                __hpcc_id: response.TpLogFileResponse.PageNumber + "_" + idx,
                                lineNo: lineNo,
github Saleslogix / argos-saleslogix / src / Views / Home.js View on Github external
createLayout: function() {
    // don't need to cache as it is only re-rendered when there is a change
    var configured,
      layout,
      visible,
      i,
      view;

    configured = lang.getObject('preferences.home.visible', false, App) || [];
    layout = [{
      id: 'actions',
      children: [{
        'name': 'AddAccountContactAction',
        'action': 'addAccountContact',
        'title': this.addAccountContactText
      }]
    }];

    visible = {
      id: 'views',
      children: []
    };

    for (i = 0; i < configured.length; i++) {
      view = App.getView(configured[i]);
github Esri / storymap-crowdsource / src / app / utils / appData / CrowdsourceVersionUpdate.babel.js View on Github external
if (lang.exists('data.values.settings.components.map.crowdsourceLayer.fields.PrimaryPhoto.extras',updatedItemInfo)) {
    lang.setObject('data.values.settings.components.map.crowdsourceLayer.fields.PrimaryPhoto.extras.minimumSize',1000,updatedItemInfo);
  }

  // Add source attribute
  lang.setObject('data.source','StoryMap_Crowdsource_Builder',updatedItemInfo);

  // Update version
  lang.setObject('data.values.properties.version',newVersion,updatedItemInfo);
  lang.setObject('data.values.properties.versionUpdated',new Date().getTime(),updatedItemInfo);

  // Update webmap layers to use https
  if (appState.mode.isBuilder) {
    const portal = lang.getObject('app.portal',false,appState);
    const webmap = lang.getObject('data.values.settings.components.map.webmap',false,currentItemInfo);
    const layerId = lang.getObject('data.values.settings.components.map.crowdsourceLayer.id',false,currentItemInfo);
    const token = lang.getObject('app.portal.user.credential.token',false,appState);
    const itemUrl = portal.portalUrl.stripTrailingSlash() + '/content/items/' + webmap;

    const updateWebmapItem = function (item,data) {
      let url;

      if (data && data.operationalLayers) {
        data.operationalLayers = data.operationalLayers.reduce((prev,current) => {
          if (current.id === layerId) {
            url = new URI(current.url).protocol('https').href();
            current.url = url;
          }
          return prev.concat(current);
        },[]);

        data.baseMap.baseMapLayers = data.baseMap.baseMapLayers.reduce((prev,current) => {
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Models / SalesOrder / SData.js View on Github external
* distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import Base from './Base';
import _SDataModelBase from 'argos/Models/_SDataModelBase';
import Manager from 'argos/Models/Manager';
import ErrorManager from 'argos/ErrorManager';
import MODEL_TYPES from 'argos/Models/Types';
import MODEL_NAMES from '../Names';

const __class = declare('crm.Integrations.BOE.Models.SalesOrder.SData', [Base, _SDataModelBase], {
  id: 'salesorder_sdata_model',
  createQueryModels: function createQueryModels() {
    return [{
      name: 'list',
      queryWhere: 'IsQuote eq false',
      queryOrderBy: 'ErpDocumentDate desc, OrderDate desc',
      querySelect: [
        'SalesOrderNumber',
        'Account/AccountName',
        'Status',
        'ErpExtId',
        'CustomerPurchaseOrderNumber',
        'DocGrandTotal', // Document Total
        'GrandTotal', // Base Total
        'OrderDate',
        'CreateDate',
github Saleslogix / argos-saleslogix / src / Views / MainToolbar.js View on Github external
*
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import declare from 'dojo/_base/declare';
import has from 'dojo/has';
import MainToolbar from 'argos/MainToolbar';
import getResource from 'argos/I18n';

const resource = getResource('mainToolbar');

const __class = declare('crm.Views.MainToolbar', [MainToolbar], {
  backTooltipText: resource.backTooltipText,

  showTools: function showTools(tools) {
    let isOnEdit;
    const isOnFirstView = App.isOnFirstView();

    if (tools) {
      for (let i = 0; i < tools.length; i++) {
        if (tools[i].id === 'cancel') {
          isOnEdit = true;
        }
      }
    }

    if (tools !== false) {
      tools = tools || []; // eslint-disable-line
github Saleslogix / argos-saleslogix / src / Views / Lead / List.js View on Github external
*/

import declare from 'dojo/_base/declare';
import action from '../../Action';
import format from '../../Format';
import utility from 'argos/Utility';
import List from 'argos/List';
import _GroupListMixin from '../_GroupListMixin';
import _MetricListMixin from '../_MetricListMixin';
import _RightDrawerListMixin from '../_RightDrawerListMixin';
import getResource from 'argos/I18n';
import MODEL_NAMES from '../../Models/Names';

const resource = getResource('leadList');

const __class = declare('crm.Views.Lead.List', [List, _RightDrawerListMixin, _MetricListMixin, _GroupListMixin], {
  // Templates
  itemTemplate: new Simplate([
    '<p class="micro-text">',
    '{%: $$.joinFields(" | ", [$$.formatPicklist("Title")($.Title), $.Company]) %}',
    '</p>',
    '{% if ($.WorkPhone) { %}',
    '<p class="micro-text">',
    '{%: $$.phoneAbbreviationText %} <span data-key="{%: $.$key %}" data-action="callWork" class="hyperlink">{%: argos.Format.phone($.WorkPhone) %}</span>', // TODO: Avoid global
    '</p>',
    '{% } %}',
    '{% if ($.Mobile) { %}',
    '<p class="micro-text">',
    '{%: $$.mobileAbbreviationText %} <span data-key="{%: $.$key %}" data-action="callMobile" class="hyperlink">{%: argos.Format.phone($.Mobile) %}</span>', // TODO: Avoid global
    '</p>',
    '{% } %}',
    '{% if ($.TollFree) { %}',
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Views / ERPSalesOrderPersons / List.js View on Github external
import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import string from 'dojo/string';
import List from 'argos/List';
import _CardLayoutListMixin from 'crm/Views/_CardLayoutListMixin';
import _RightDrawerListMixin from 'crm/Views/_RightDrawerListMixin';
import _MetricListMixin from 'crm/Views/_MetricListMixin';
import MODEL_NAMES from '../../Models/Names';
import getResource from 'argos/I18n';

const resource = getResource('erpSalesOrderPersonsList');

const __class = declare('crm.Integrations.BOE.Views.ERPSalesOrderPersons.List', [List, _RightDrawerListMixin, _MetricListMixin, _CardLayoutListMixin], {
  // Templates
  // TODO: Need template from PM
  itemTemplate: new Simplate([
    '<h3>{%: $.ErpPerson.Name %}</h3>',
    '<div class="h4 address">{%: $.ErpPerson.Address.FullAddress %}</div>',
  ]),

  // Localization
  titleText: resource.titleText,

  // View Properties
  id: 'erpsalesorderperson_list',
  modelName: MODEL_NAMES.ERPSALESORDERPERSON,
  resourceKind: 'erpSalesOrderPersons',
  allowSelection: true,
  enableActions: true,
github Saleslogix / argos-saleslogix / src / Views / Charts / _ChartMixin.js View on Github external
/**
 * @module crm/Views/Charts/_ChartMixin
 */
import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import connect from 'dojo/_base/connect';
import domGeo from 'dojo/dom-geometry';
import domAttr from 'dojo/dom-attr';
import has from 'dojo/has';
import _PullToRefreshMixin from 'argos/_PullToRefreshMixin';
import Utility from 'argos/Utility';
import getResource from 'argos/I18n';

const resource = getResource('chartMixin');

lang.setObject('Chart.defaults.global', {
  // Boolean - Whether to animate the chart
  animation: false,

  // Number - Number of animation steps
  animationSteps: 60,

  // String - Animation easing effect
  animationEasing: 'easeOutQuart',

  // Boolean - If we should show the scale at all
  showScale: true,

  // Boolean - If we want to override with a hard coded scale
  scaleOverride: false,

  // ** Required if scaleOverride is true **

dojo

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

BSD-3-Clause OR AFL-2.1
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis