Ext. Data-connection/ajax/Record

Source: Internet
Author: User
Ext. Data. Connection
Access the specified URL. This is an asynchronous call class. If you want to obtain server information, specify the callback method or specified listener in the request parameter (it is invalid for file upload)

Connection (Object config)
Constructor. config is defined {
Autoabort: Boolean,
Defaultheaders: object,
Disablecaching: Boolean,
Extraparams: object,
Method: string,
Timeout: Number,
URL: String
}
Object

Method: The method inherited by observable is omitted.
Abort ([number transactionid]): void
Discard the request. If multiple requests occur at the same time, the parameter indicatesProgramNo. If this parameter is not specified, the last request is abandoned.

Isloading ([number transactionid]): Boolean
Whether or not the transactionid request is loaded. The last request is not approved.

request ([object options]): number
the most practical method is of course, the returned result is the process ID required by the preceding two methods.
options is defined as {
URL: String, // request URL
Params: object/string/function, // parameters passed during POST request
method: String, // get/post
callback: function, // call back method, whether it is successful or failed, this method will be called. There are three parameters, the options parameter passed in by options, success: Boolean, success? Response: object: the XMLHTTPRequest object containing the returned data
success: function, // call back when the call is successful. The first parameter is the XMLHTTPRequest object, the second parameter is used to pass in the specified options
failure: function, // call back upon failure. The parameter is the same as success
scope: object, // range
form: object/string, // a form object or its ID, which can automatically generate the Params parameter
isupload: Boolean, // file upload? Generally, you can automatically detect
headers: object, // request header information to be customized
xmldata: Object // an XML document object, it will initiate a request by adding parameters to the URL
disablecaching: Boolean // do you want to disable caching? True by default
}

Ext. Ajax
Inherited from Ext. Data. connection, the method is the same as the parent class, but it is simpler to use. It is a globally unique static class.
Example:
Ext. Ajax. Request ({
URL: 'foo. php ',
Success: somefn,
Failure: otherfn,
Headers :{
'My-header': 'foo'
},
Params: {FOO: 'bar '}
});

Ext. Ajax. Request ({
Form: 'Some-form ',
Params: 'foo = bar'
});

// Add the default header for all Ext. Ajax requests.
Ext. Ajax. defaultheaders = {
'Powered-by': 'ext'
};

// All ext and Ajax calls showspinner before initiating a request
Ext. Ajax. On ('beforerequest ', this. showspinner, this );

Ext. Data. Record
Basically, it can be understood as the datarow in. Net or a row of data in SQL Server. It stores the data definition information and their values.
[Public attributes]
Data: object data content, a JSON object
Dirty: whether Boolean has been modified
ID: the unique ID of the object. By default, the object is shaved from 1000 to 1.
Modified: if the object record has not been modified, it is null. If it has been modified, it stores the original value information.
[Public method]
Record (array data, [Object ID])
This constructor is not used to create a record object. Instead, you should use the Create method to create a record object. For the parameter data definition, see the create method. The start ID of ID increments by default.

Beginedit (): void
Start Modification

Canceledit (): void
Discard the modification. For more information, see commit.

Copy ([String id]): Record
// Create a clone value for the current record. If no ID is specified, use the current ID + 1

Commit ([Boolean silent]): void
The commit method is generally called by the store object instead of the recorde itself. It submits all changes after self-creation or the last modification. If the silent is true, it will not notify the store object

Create ([array o]): Function
Static constructor o is the config Array
Config can contain the following attributes:
{
Name: String // field name
Mapping: String // reader ing relationship used for reader. If it is used for jsonreader, use the Javascript expression relative to the current record.
// If it is used for xmlreader, it is relative to the domquery expression of the record. For arrayreader, It is the serial number.
Type: String // optional values: Auto/string/INT/float/Boolean/date. Auto is the default value and is not converted.
Sorttype: Mixed // sorting type, which is a member of Ext. Data. sorttypes. For more information, see sorttypes.
Sortdir: String // One of ASC/DESC values in reverse order
Convert: function // conversion function. This function is very useful and can be customized to receive the processed value returned by the current value.
Dateformat: String // Date Format String. Convert: function is a special case. The current date is converted using the date. parsedate method.
}

Endedit (): void
End Modification

Get (name {string}): Object
Specify the string value of the Name field

Getchanges (): Object
Returns the object of the modification record.

Reject ([Boolean silent]): void
Similar to commit, the modification is rejected.

set (string name, object Value): void
set a new value for the field name

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.