Table data model for comma-separated (or tab-separated) text files.
CSV table is based on AW.HTTP.Request class. It splits the returned text into rows and cells and implements getCount() and getData(col, row) methods to provide the data into the grid control.
var obj = new AW.CSV.Table;
async | Indicates whether asynchronous download is permitted. |
count | Row count. |
data | Cell data. |
namespace | Allows to specify namespaces for use in XPath expressions. |
parameter | Allows to specify the request arguments/parameters. |
password | Sets or retrieves the password. |
requestData | Allows to send data with the request. |
requestHeader | Sets HTTP request header. |
requestMethod | Specifies HTTP request method. |
responseHeader | Returns HTTP response header (for example "Content-Type"). |
responseText | Returns response text. |
responseXML | Returns response XML. |
URL | Sets or retrieves the remote data URL. |
username | Sets or retrieves the user name. |
clone | Creates an object clone. |
defineProperty | Creates get/set methods for the property. |
getAsync | Returns async property |
getCount | Returns count property |
getData | Returns data property |
getPassword | Returns password property |
getProperty | Returns property value. |
getRequestData | Returns requestData property |
getRequestMethod | Returns requestMethod property |
getResponseHeader | Returns responseHeader property |
getResponseText | Returns responseText property |
getResponseXML | Returns responseXML property |
getURL | Returns URL property |
getUsername | Returns username property |
init | Initializes the object. |
isReady | Returns true if the model data is available. |
request | Sends the request. |
response | Allows to process the received data. |
setAsync | Sets async property |
setNamespace | Sets namespace property |
setParameter | Sets parameter property |
setPassword | Sets password property |
setProperty | Assigns property value. |
setRequestData | Sets requestData property |
setRequestHeader | Sets requestHeader property |
setRequestMethod | Sets requestMethod property |
setResponseText | Sets responseText property |
setResponseXML | Sets responseXML property |
setTimeout | Calls the function after the specified delay. |
setURL | Sets URL property |
setUsername | Sets username property |
toString | Converts object to string. |
// create external data model - CSV text table
var table = new AW.CSV.Table;
// set data URL - plain text comma-separated file
table.setURL("../data/companies.csv");
// start asynchronous data retrieval
table.request();
// create ActiveWidgets Grid javascript object
var obj = new AW.UI.Grid;
// assign external cell data model
obj.setCellModel(table);
// set the number of columns, row count is taken from the table
obj.setColumnCount(5);
// write grid html to the page
document.write(obj);