Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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)){
}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
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;
},
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;
},
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;
},
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;
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(){
}
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){
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
};
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(){