Proxy object¶
A proxy object is a normal JavaScript object with a flag $proxy
member set
to true
. The available doc on webix site can be found here, but it
doesn’t explain so much about the internals of loading and saving
process. I can implement the following functions:
-
proxy.
load
(view, callback)¶ It’s called by a data-bound component to fill in with the data values.
Arguments: - view (Object) – This is the calling object, it can be a view in the
strict sense of the term, or a
DataCollection()
component or anything that is extended withAtomDataLoader()
mixin. - callback (Object) – An object passed in by the calling context that has
the
success
anderror
members. It is tailored to be passed to an AJAX call.
- view (Object) – This is the calling object, it can be a view in the
strict sense of the term, or a
-
proxy.
save
(view, update, dp, callback)¶ It’s called by a
DataProcessor()
object which is in turn bound via amaster
configuration member to the same object that calls theload()
function. If there’s noDataProcessor()
connected, this will never be called.Arguments: - view (Object) – This is the calling object, it can be a view in the
strict sense of the term, or a
DataCollection()
component or anything that is extended withAtomDataLoader()
mixin. - update (Object) – Contains the actual data to be submitted to the
server. The record is in a
data
member and the kind of operation to be performed is in theoperation
member that can have the valuesinsert
,update
,delete
. - dp (
DataProcessor()
) – The linked processor, the actual context that is calling this method. - callback (Object) – An object passed in by the calling context that has
the
success
anderror
members. It is tailored to be passed to an AJAX call.
- view (Object) – This is the calling object, it can be a view in the
strict sense of the term, or a
DataCollection loading process¶
The code executed to load the data from the proxy for a component like the
DataCollection()
is scattered among many components and
mixins. This a tentative to have better understanding of how that happens in
the context of building a data layer for Ytefas.
The basic code is in AtomDataLoader()
mixin that uses a
DataDriver()
instance (a json()
by
default) to recognize key elements of the data. This is extended by
DataLoader()
mixin which adds storage support using an instance
of the DataStore()
component. This is in turn extended by the
DataCollection()
code which unifies this feature with sync()
and bind()
implementations and cursor management.