root / trunk / web / dojo / dojox / wire / ml / DataStore.js
History | View | Annotate | Download (1.14 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.wire.ml.DataStore"]){ |
||
9 | dojo._hasResource["dojox.wire.ml.DataStore"]=true; |
||
10 | dojo.provide("dojox.wire.ml.DataStore");
|
||
11 | dojo.require("dijit._Widget");
|
||
12 | dojo.require("dojox.wire._base");
|
||
13 | dojo.declare("dojox.wire.ml.DataStore",dijit._Widget,{storeClass:"",postCreate:function(){ |
||
14 | this.store=this._createStore(); |
||
15 | },_createStore:function(){ |
||
16 | if(!this.storeClass){ |
||
17 | return null; |
||
18 | } |
||
19 | var _1=dojox.wire._getClass(this.storeClass); |
||
20 | if(!_1){
|
||
21 | return null; |
||
22 | } |
||
23 | var _2={};
|
||
24 | var _3=this.domNode.attributes; |
||
25 | for(var i=0;i<_3.length;i++){ |
||
26 | var a=_3.item(i);
|
||
27 | if(a.specified&&!this[a.nodeName]){ |
||
28 | _2[a.nodeName]=a.nodeValue; |
||
29 | } |
||
30 | } |
||
31 | return new _1(_2); |
||
32 | },getFeatures:function(){ |
||
33 | return this.store.getFeatures(); |
||
34 | },fetch:function(_4){ |
||
35 | return this.store.fetch(_4); |
||
36 | },save:function(_5){ |
||
37 | this.store.save(_5);
|
||
38 | },newItem:function(_6){ |
||
39 | return this.store.newItem(_6); |
||
40 | },deleteItem:function(_7){ |
||
41 | return this.store.deleteItem(_7); |
||
42 | },revert:function(){ |
||
43 | return this.store.revert(); |
||
44 | }}); |
||
45 | } |