How to use the dojo.data.api.Write function in dojo

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 cloudjee / wavemaker / wavemaker / wavemaker-studio / src / main / webapp / lib / dojo / dojo / data / ItemFileWriteStore.js View on Github external
//			type1: function || object,
		//			...
		//			typeN: function || object
		//		}
		//		Where if it is a function, it is assumed to be an object constructor that takes the
		//		value of _value as the initialization parameters.  It is serialized assuming object.toString()
		//		serialization.  If it is an object, then it is assumed
		//		to be an object of general form:
		//		{
		//			type: function, //constructor.
		//			deserialize:	function(value) //The function that parses the value and constructs the object defined by type appropriately.
		//			serialize:	function(object) //The function that converts the object back into the proper file format form.
		//		}

		// ItemFileWriteStore extends ItemFileReadStore to implement these additional dojo.data APIs
		this._features['dojo.data.api.Write'] = true;
		this._features['dojo.data.api.Notification'] = true;
		
		// For keeping track of changes so that we can implement isDirty and revert
		this._pending = {
			_newItems:{},
			_modifiedItems:{},
			_deletedItems:{}
		};

		if(!this._datatypeMap['Date'].serialize){
			this._datatypeMap['Date'].serialize = function(obj){
				return dojo.date.stamp.toISOString(obj, {zulu:true});
			};
		}
		//Disable only if explicitly set to false.
		if(keywordParameters && (keywordParameters.referenceIntegrity === false)){
github oria / gridx / build / dojo / store / DataStore.js View on Github external
}catch(e){ 
	 		// some store are not requiring an item instance to give us the ID attributes 
	 		// but some other do and throw errors in that case. 
			} 
			// if no idAttribute we have implicit id 
			this.idProperty = (!idAttribute || !idAttributes[0]) || this.idProperty; 
		}
		var features = this.store.getFeatures();
		// check the feature set and null out any methods that shouldn't be available
		if(!features["dojo.data.api.Read"]){
			this.get = null;
		}
		if(!features["dojo.data.api.Identity"]){
			this.getIdentity = null;
		}
		if(!features["dojo.data.api.Write"]){
			this.put = this.add = null;
		}
	},
	// idProperty: String
github mayflower / PHProjekt / phprojekt / htdocs / dojo / release / dojo / dojox / data / JsonRestStore.js View on Github external
getFeatures: function(){
			// summary:
			// 		return the store feature set
			var features = this.inherited(arguments);
			features["dojo.data.api.Write"] = true;
			features["dojo.data.api.Notification"] = true;
			return features;
		},
github oria / gridx / build / dojox / data / JsonRestStore.js View on Github external
getFeatures: function(){
			// summary:
			//		return the store feature set
			var features = this.inherited(arguments);
			features["dojo.data.api.Write"] = true;
			features["dojo.data.api.Notification"] = true;
			return features;
		},
github nextgis / nextgisweb / nextgisweb / amd_packages / contrib / dojox / data / JsonRestStore.js.uncompressed.js View on Github external
getFeatures: function(){
			// summary:
			//		return the store feature set
			var features = this.inherited(arguments);
			features["dojo.data.api.Write"] = true;
			features["dojo.data.api.Notification"] = true;
			return features;
		},
github dojo / dojox-oldmirror / grid / enhanced / plugins / Rearrange.js View on Github external
rowCnt = g.rowCount,
				mapping = {},
				obj = {idx: 0},
				newRows = [],
				i,
				emptyTarget = targetPos < 0,
				_this = this,
				len = rowsToMove.length;
			if(emptyTarget){
				targetPos = 0;
			}else{
				for(i = targetPos; i < g.rowCount; ++i){
					mapping[i] = i + len;
				}
			}
			if(s.getFeatures()['dojo.data.api.Write']){
				if(sourceGrid){
					var srcg = sourceGrid,
						srcs = srcg.store,
						thisItem, attrs;
					if(!emptyTarget){
						for(i = 0; !thisItem; ++i){
							thisItem = g._by_idx[i];
						}
						attrs = s.getAttributes(thisItem.item);
					}else{
						//If the target grid is empty, there is no way to retrieve attributes.
						//So try to get attrs from grid.layout.cells[], but this might not be right
						//since some fields may be missed(e.g ID fields), please use "setIdentifierForNewItem()" 
						//to add those missed fields
						attrs = array.filter(array.map(g.layout.cells, function(cell){
							return cell.field;
github dojo / dojox-oldmirror / grid / enhanced / plugins / DnD.js View on Github external
var srcRegion = sourcePlugin._dndRegion;
		var type = srcRegion.type;
		if(!this._config[type]["in"] || !sourcePlugin._config[type]["out"]){
			return false;
		}
		var g = this.grid;
		var ranges = srcRegion.selected;
		var colCnt = array.filter(g.layout.cells, function(cell){
			return !cell.hidden;
		}).length;
		var rowCnt = g.rowCount;
		var res = true;
		switch(type){
			case "cell":
				ranges = ranges[0];
				res = g.store.getFeatures()["dojo.data.api.Write"] &&
					(ranges.max.row - ranges.min.row) <= rowCnt &&
					array.filter(sourcePlugin.grid.layout.cells, function(cell){
						return cell.index >= ranges.min.col && cell.index <= ranges.max.col && !cell.hidden;
					}).length <= colCnt;
				//intentional drop through - don't break
			case "row":
				if(sourcePlugin._allDnDItemsLoaded()){
					return res;
				}
		}
		return false;
	},
	_allDnDItemsLoaded: function(){
github dojo / dojox-oldmirror / wire / ml / Invocation.js View on Github external
}
			var args = this._getParameters(arguments);
			var func = scope[this.method];
			if(!func){
				func = scope.callMethod;
				if(!func){
					return; //undefined
				}
				args = [this.method, args];
			}
			try{
				var connected = false;
				if(scope.getFeatures){
					var features = scope.getFeatures();
					if((this.method == "fetch" && features["dojo.data.api.Read"]) ||
						(this.method == "save" && features["dojo.data.api.Write"])){
						var arg = args[0];
						if(!arg.onComplete){
							arg.onComplete = function(){};
						}
						//dojo.connect(arg, "onComplete", this, "onComplete");
						this.connect(arg, "onComplete", "onComplete");
						if(!arg.onError){
							arg.onError = function(){};
						}
						//dojo.connect(arg, "onError", this, "onError");
						this.connect(arg, "onError", "onError");
						connected = true;
					}
				}
				var r = func.apply(scope, args);
				if(!connected){
github fluid-project / infusion / src / webapp / component-templates / js / dojo / data / api / Write.js View on Github external
if(!dojo._hasResource["dojo.data.api.Write"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo.data.api.Write"] = true;
dojo.provide("dojo.data.api.Write");
dojo.require("dojo.data.api.Read");

dojo.declare("dojo.data.api.Write", dojo.data.api.Read, {
	//	summary:
	//		This is an abstract API that data provider implementations conform to.  
	//		This file defines function signatures and intentionally leaves all the
	//		functionss unimplemented.

	getFeatures: function(){
		//	summary: 
		//		See dojo.data.api.Read.getFeatures()
		return {
			'dojo.data.api.Read': true,
			'dojo.data.api.Write': true
		};
github mayflower / PHProjekt / phprojekt / htdocs / dojo / dojox / grid / enhanced / plugins / DnD.js View on Github external
var srcRegion = sourcePlugin._dndRegion;
		var type = srcRegion.type;
		if(!this._config[type]["in"] || !sourcePlugin._config[type]["out"]){
			return false;
		}
		var g = this.grid;
		var ranges = srcRegion.selected;
		var colCnt = dojo.filter(g.layout.cells, function(cell){
			return !cell.hidden;
		}).length;
		var rowCnt = g.rowCount;
		var res = true;
		switch(type){
			case "cell":
				ranges = ranges[0];
				res = g.store.getFeatures()["dojo.data.api.Write"] &&
					(ranges.max.row - ranges.min.row) <= rowCnt &&
					dojo.filter(sourcePlugin.grid.layout.cells, function(cell){
						return cell.index >= ranges.min.col && cell.index <= ranges.max.col && !cell.hidden;
					}).length <= colCnt;
				//intentional drop through - don't break
			case "row":
				if(sourcePlugin._allDnDItemsLoaded()){
					return res;
				}
		}
		return false;
	},
	_allDnDItemsLoaded: function(){

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

57 / 100
Full package analysis