store.Base Class
Extends
Item Index
Methods
destroy
()
remove data
getData
()
Object
Returns the store data attribute
Returns:
store data
getRawData
-
initial
provide the raw data
Parameters:
-
initial
Boolean[default=false] (optional) set to true if you want the original data passed to setData() - if left out or false - it will parse the ko-ed data back to a JS object
Returns:
getUrl
-
type
return the correct url when getting or submitting the store
Parameters:
-
type
Stringoptional - "get", "submit"
Returns:
init
()
Called on creation
load
-
options
Load the store - see data.store:loadStore
Parameters:
-
options
Object
Returns:
self
Example:
load({
callback:function(){},
scope:this //scope for callback
})
setData
-
data
Converts a json object into stores with records
Parameters:
-
data
Object
Returns:
self
submit
()
Object
Submit the store data to the specified url.submit path see data.store:submit
Returns:
self
toJson
()
String
Convert store data to json string
Returns:
json
toPlainObject
()
Object
convert store data to a plain object
Returns:
Properties
_initialData
Object
private
initial raw data that was passed when setting the store with setData() function
Default: null
async
Boolean
default value
Default: true
autoLoad
Boolean
load store on creation
Default: false
data
Object
data store - use setData()
Default: null
dataInitialised
Boolean
private
Whether the data in the store has been initialised, ie. convert to records etc.
Default: false
dataType
String
Default store configurations any types that jQuery allows in $.ajax()
Default: "json"
get
String
Default: null
isStore
Boolean
private
Simple property to check whether this object is a store
Default: true
loadProtocol
String
set the connection protocol, POST or GET for load
Default: "GET"
params
Object
pass parameters when loading the store
Default: null
root
String
specify a root - used when calling getData()
Default: null
status
String
private
Store status
- initial :: store has just been created
- preload :: store is just about to fire the $.ajax event
- any :: success status of $.ajax()
stringifyData
Boolean
Default: true
submit
String
Default: null
submitProtocol
String
set the connection protocol, POST or GET for submit
Default: "POST"
url
String, Object string :: only a get store - i.e. 1-way store, get information from the server. object :: mutliple directional store - get and send information to and from the server
URL Config:
Example:
url: "/getusers.php"
url: {
get:"/getusers.php",
submit: "/saveusers.php"
}