Class xataface.IO
Defined in: IO.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Just a placeholder class.
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
xataface.IO.insert(table, vals, callback)
Inserts a record into the database.
|
| <static> |
xataface.IO.InsertCallback(param)
A callback function to be passed as the callback to xataface.IO.save
|
| <static> |
xataface.IO.load(query, callback)
Loads a record via AJAX using Xataface query conventions.
|
| <static> |
xataface.IO.LoadCallback(record)
Callback function format that can be passed to the xataface.IO.load() function.
|
| <static> |
xataface.IO.update(recordId, vals, callback)
Updates a record's values in the database.
|
| <static> |
xataface.IO.UpdateCallback(param)
A callback function to be passed as the callback to xataface.IO.save
|
Class Detail
xataface.IO()
Just a placeholder class. Most functions are static.
//require <xataface/IO.js>
var IO = XataJax.load('xataface.IO');
var recordId = 'people?person_id=10';
IO.load(recordId, function(res){
alert("Person was loaded: "+res.first_name);
// Now let's make a change and save them
var newVals = {
first_name: res.first_name+' changed'
};
IO.update(recordId, newVals, function(updateRes){
if ( updateRes.code == 200 ){
alert('Successfully saved changes');
} else {
alert("Failed: "+updateRes.message);
}
});
});
Method Detail
<static>
{void}
xataface.IO.insert(table, vals, callback)
Inserts a record into the database.
- Parameters:
- {String} table
- The name of the table to insert into.
- {Object} vals
- Key-value pairs of the data to insert in the record.
- {xataface.IO.InsertCallback} callback
- A callback function to call on completion.
- Returns:
- {void}
<static>
xataface.IO.InsertCallback(param)
A callback function to be passed as the callback to xataface.IO.save
- Parameters:
- {Object} param
- {int} param.code
- The response code. 200 for success. Anything else for failure.
- {String} param.message
- The message indicating what happened. A server status message.
- {String} param.recordId
- The ID of the record that was updated. (Only included upon successful update.
- See:
- xataface.IO.insert
<static>
xataface.IO.load(query, callback)
Loads a record via AJAX using Xataface query conventions.
- Parameters:
- {Object} query
- The Xataface query to specify which record to load.
- {xataface.IO.LoadCallback} callback
- The callback function to call when loading is complete.
<static>
xataface.IO.LoadCallback(record)
Callback function format that can be passed to the xataface.IO.load() function.
- Parameters:
- {Object} record
- The record that was retrieved.
-
{String} record.
- The value of a field in the record.
- See:
- The dataface_actions_export_json action for the format of the response.
<static>
{void}
xataface.IO.update(recordId, vals, callback)
Updates a record's values in the database.
- Parameters:
- {String} recordId
- The Xataface Record ID of the record to update.
- {Object} vals
- Key-value pairs of the data to update in the record.
- {xataface.IO.UpdateCallback} callback
- A callback function to call on completion.
- Returns:
- {void}
<static>
xataface.IO.UpdateCallback(param)
A callback function to be passed as the callback to xataface.IO.save
- Parameters:
- {Object} param
- {int} param.code
- The response code. 200 for success. Anything else for failure.
- {String} param.message
- The message indicating what happened. A server status message.
- {String} param.recordId
- The ID of the record that was updated. (Only included upon successful update.
- See:
- xataface.IO.update