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 with AtomDataLoader() mixin.
  • callback (Object) – An object passed in by the calling context that has the success and error members. It is tailored to be passed to an AJAX call.
proxy.save(view, update, dp, callback)

It’s called by a DataProcessor() object which is in turn bound via a master configuration member to the same object that calls the load() function. If there’s no DataProcessor() 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 with AtomDataLoader() 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 the operation member that can have the values insert, 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 and error members. It is tailored to be passed to an AJAX call.

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.