Ext.NET  5.3.0
.NET Component Framework for Enterprise Level Apps
Ext.Net.AbstractWriter Class Reference

Base Writer class used by most subclasses of Ext.data.proxy.Server. This class is responsible for taking a set of Ext.data.Operation objects and a Ext.data.Request object and modifying that request based on the Operations. More...

Inheritance diagram for Ext.Net.AbstractWriter:
Ext.Net.BaseItem Ext.Net.IAlias Ext.Net.IXObject Ext.Net.IBase Ext.Net.JsonWriter Ext.Net.XmlWriter

Classes

class  Builder
 
class  Config
 

Properties

override string InstanceOf [get]
 
abstract string Type [get]
 Alias More...
 
virtual DataOptions?? AllDataOptions [get]
 This object contains the options passed to Ext.data.Model.getData when writing Ext.data.Model.phantom records or when writeAllFields is set to true. NOTE: The serialize option cannot be used here. Defaults to: {persist: true} More...
 
virtual string AllDataOptionsProxy [get]
 A proxy to serialize AllDataOptions More...
 
virtual string NameProperty [get, set]
 This property is used to read the key for each value that will be sent to the server. For example: More...
 
virtual bool WriteAllFields [get, set]
 True to write all fields from the record to the server. If set to false it will only send the fields that were modified. Defaults to false. More...
 
virtual JFunction GetRecordData [get]
 Formats the data for each record before sending it to the server. This method should be overridden to format the data in a way that differs from the default. Parameters record : Object The record that we are writing to the server. Returns An object literal of name/value keys to be written to the server. By default this method returns the data property on the record. More...
 
virtual JFunction FilterRecord [get]
 
virtual JFunction FilterField [get]
 
virtual JFunction Prepare [get]
 
virtual bool ExcludeId [get, set]
 
virtual bool SkipIdForPhantomRecords [get, set]
 
virtual bool SkipPhantomId [get, set]
 
virtual bool HtmlEncode [get, set]
 Configure true to encode html in record data before sending More...
 
virtual string ClientIdProperty [get, set]
 When specified this property causes the Ext.data.Model.idProperty of newly created records to be sent to the server as this name instead of the value of the idProperty. More...
 
virtual string DateFormat [get, set]
 
string PropertyName [get]
 
virtual DataOptions?? PartialDataOptions [get]
 This object contains the options passed to Ext.data.Model.getData when writing non Ext.data.Model.phantom records or when writeAllFields is set to false. NOTE: The serialize option cannot be used here. Defaults to: {changes: true, critical: true} More...
 
virtual string PartialDataOptionsProxy [get]
 A proxy to serialize PartialDataOptions More...
 
virtual TransformFunction Transform [get]
 If a transform function is set, it will be invoked just before writeRecords executes. It is passed the unserialized data object and the request object. The transform function returns a data object, which can be a modified version of the original data object, or a completely new data object. The transform can be a function, or an object with a 'fn' key and an optional 'scope' key. Example usage: Ext.create('Ext.data.Store', { model: 'User', proxy: { type: 'ajax', url : 'users.json', writer: { type: 'json', transform: { fn: function(data, request) { /// do some manipulation of the unserialized data object return data; }, scope: this } } } }); More...
 
virtual string TransformProxy [get]
 A proxy to render .Transform to client More...
 
virtual bool WriteRecordId [get, set]
 By default, each record's id is always included in the output for non-phantom records since in most cases the id will be required on the server to process the record action. This is helpful since the id will normally not be modified, and so would not be sent to the server unless writeAllFields was explicitly enabled. However, there are cases where it is not desirable for the record id to be passed in the data directly. For example, when using a RESTful API the record id would typically be appended to the url instead. Defaults to: true More...
 
override ConfigOptionsCollection ConfigOptions [get]
 
- Properties inherited from Ext.Net.BaseItem
virtual string InstanceOf [get]
 
ItemState State [get]
 
virtual DefaultValueMode DefaultValueMode [get, set]
 
virtual bool DesignMode [get]
 
bool AutoDataBind [get, set]
 
ResourceManager ResourceManager [get]
 
virtual Control Owner [get, set]
 The Owner Control for this Listener. More...
 
virtual bool IsDefault [get]
 Does this object currently represent it's default state. More...
 
bool IsTrackingViewState [get]
 
EventHandlerList Events [get]
 
EventHandler DataBinding
 
Control?? BindingContainer [get]
 
virtual ConfigItemCollection?? CustomConfig [get]
 Collection of custom js config More...
 
virtual ConfigOptionsCollection ConfigOptions [get]
 
virtual ConfigOptionsExtraction ConfigOptionsExtraction [get]
 
System.Web.Mvc.HtmlHelper?? HtmlHelper [get, set]
 
- Properties inherited from Ext.Net.IXObject
ConfigOptionsCollection ConfigOptions [get]
 
ConfigOptionsExtraction ConfigOptionsExtraction [get]
 
DefaultValueMode DefaultValueMode [get, set]
 
- Properties inherited from Ext.Net.IAlias
string PropertyName [get]
 

Additional Inherited Members

- Public Member Functions inherited from Ext.Net.BaseItem
virtual bool HasExplicitValue (string name)
 
void EnsureDataBind ()
 
virtual void Call (string name)
 
virtual void Call (string name, params object[] args)
 
virtual void AddScript (string script)
 
virtual void AddScript (string script, params object[] args)
 
virtual bool IsEmptyObject ()
 
Apply< T > (IApply config)
 
BaseItem Apply (object config)
 
virtual void LoadViewState (object state)
 
virtual object SaveViewState ()
 
virtual void TrackViewState ()
 
void SetDirty ()
 
virtual void DataBind ()
 
virtual IControlBuilder ToNativeBuilder ()
 
- Protected Member Functions inherited from Ext.Net.BaseItem
 BaseItem (Control owner)
 
 BaseItem ()
 
virtual void OwnerUpdate (Control owner)
 
virtual void OnDataBinding (EventArgs e)
 

Detailed Description

Base Writer class used by most subclasses of Ext.data.proxy.Server. This class is responsible for taking a set of Ext.data.Operation objects and a Ext.data.Request object and modifying that request based on the Operations.

For example a Ext.data.writer.Json would format the Operations and their Ext.data.Model instances based on the config options passed to the JsonWriter's constructor.

Writers are not needed for any kind of local storage - whether via a Web Storage proxy (see localStorage and sessionStorage) or just in memory via a MemoryProxy.

Property Documentation

◆ AllDataOptions

virtual DataOptions?? Ext.Net.AbstractWriter.AllDataOptions
get

This object contains the options passed to Ext.data.Model.getData when writing Ext.data.Model.phantom records or when writeAllFields is set to true. NOTE: The serialize option cannot be used here. Defaults to: {persist: true}

◆ AllDataOptionsProxy

virtual string Ext.Net.AbstractWriter.AllDataOptionsProxy
getprotected

A proxy to serialize AllDataOptions

◆ ClientIdProperty

virtual string Ext.Net.AbstractWriter.ClientIdProperty
getset

When specified this property causes the Ext.data.Model.idProperty of newly created records to be sent to the server as this name instead of the value of the idProperty.

For example, by default, the following code:

Ext.define('Person', { idProperty: 'id', /// this is the default value (for clarity)

fields: [ 'name' ] });

var person = new Person({ /// no id provided, so one is generated name: 'Clark Kent' });

Will send this to the server:

{ id: 'Person-1', name: 'Clark Kent' }

This can be an issue if the server expects an integer for the "id" property. You can use Ext.data.Model.identifier to produce identifiers that the server would recognize or use this config to send the client's id in a different property.

Ext.define('Person', { idProperty: 'id', /// this is the default value (for clarity)

proxy: { writer: { clientIdProperty: 'clientId' } },

fields: [ 'name' ] });

Given the above, the server is sent this data now:

{ clientId: 'Person-1', name: 'Clark Kent' }

While this config provides the behavior of Ext.data.Model.clientIdProperty from previous releases, this property is not as useful as a suitable Ext.data.Model.identifier due to id's appearing in foreign-key fields and in Ext.data.Model.manyToMany associations.

See Ext.data.Model.identifier for more on id generation.

◆ ConfigOptions

override ConfigOptionsCollection Ext.Net.AbstractWriter.ConfigOptions
get

◆ DateFormat

virtual string Ext.Net.AbstractWriter.DateFormat
getset

◆ ExcludeId

virtual bool Ext.Net.AbstractWriter.ExcludeId
getset

◆ FilterField

virtual JFunction Ext.Net.AbstractWriter.FilterField
get

◆ FilterRecord

virtual JFunction Ext.Net.AbstractWriter.FilterRecord
get

◆ GetRecordData

virtual JFunction Ext.Net.AbstractWriter.GetRecordData
get

Formats the data for each record before sending it to the server. This method should be overridden to format the data in a way that differs from the default. Parameters record : Object The record that we are writing to the server. Returns An object literal of name/value keys to be written to the server. By default this method returns the data property on the record.

◆ HtmlEncode

virtual bool Ext.Net.AbstractWriter.HtmlEncode
getset

Configure true to encode html in record data before sending

◆ InstanceOf

override string Ext.Net.AbstractWriter.InstanceOf
get

◆ NameProperty

virtual string Ext.Net.AbstractWriter.NameProperty
getset

This property is used to read the key for each value that will be sent to the server. For example:

Ext.regModel('Person', { fields: [{ name: 'first', mapping: 'firstName' }, { name: 'last', mapping: 'lastName' }, { name: 'age' }] }); new Ext.data.writer.Writer({ writeAllFields: true, nameProperty: 'mapping' });

// This will be sent to the server { firstName: 'first name value', lastName: 'last name value', age: 1 }

Defaults to name. If the value is not present, the field name will always be used.

◆ PartialDataOptions

virtual DataOptions?? Ext.Net.AbstractWriter.PartialDataOptions
get

This object contains the options passed to Ext.data.Model.getData when writing non Ext.data.Model.phantom records or when writeAllFields is set to false. NOTE: The serialize option cannot be used here. Defaults to: {changes: true, critical: true}

◆ PartialDataOptionsProxy

virtual string Ext.Net.AbstractWriter.PartialDataOptionsProxy
getprotected

A proxy to serialize PartialDataOptions

◆ Prepare

virtual JFunction Ext.Net.AbstractWriter.Prepare
get

◆ PropertyName

string Ext.Net.AbstractWriter.PropertyName
get

◆ SkipIdForPhantomRecords

virtual bool Ext.Net.AbstractWriter.SkipIdForPhantomRecords
getset

◆ SkipPhantomId

virtual bool Ext.Net.AbstractWriter.SkipPhantomId
getset

◆ Transform

virtual TransformFunction Ext.Net.AbstractWriter.Transform
get

If a transform function is set, it will be invoked just before writeRecords executes. It is passed the unserialized data object and the request object. The transform function returns a data object, which can be a modified version of the original data object, or a completely new data object. The transform can be a function, or an object with a 'fn' key and an optional 'scope' key. Example usage: Ext.create('Ext.data.Store', { model: 'User', proxy: { type: 'ajax', url : 'users.json', writer: { type: 'json', transform: { fn: function(data, request) { /// do some manipulation of the unserialized data object return data; }, scope: this } } } });

◆ TransformProxy

virtual string Ext.Net.AbstractWriter.TransformProxy
getprotected

A proxy to render .Transform to client

◆ Type

abstract string Ext.Net.AbstractWriter.Type
getprotected

Alias

◆ WriteAllFields

virtual bool Ext.Net.AbstractWriter.WriteAllFields
getset

True to write all fields from the record to the server. If set to false it will only send the fields that were modified. Defaults to false.

◆ WriteRecordId

virtual bool Ext.Net.AbstractWriter.WriteRecordId
getset

By default, each record's id is always included in the output for non-phantom records since in most cases the id will be required on the server to process the record action. This is helpful since the id will normally not be modified, and so would not be sent to the server unless writeAllFields was explicitly enabled. However, there are cases where it is not desirable for the record id to be passed in the data directly. For example, when using a RESTful API the record id would typically be appended to the url instead. Defaults to: true


The documentation for this class was generated from the following files: