Class YAHOO.ext.grid.XMLDataModel
Object
|
+--YAHOO.ext.grid.AbstractDataModel
|
+--YAHOO.ext.grid.DefaultDataModel
|
+--YAHOO.ext.grid.LoadableDataModel
|
+--YAHOO.ext.grid.XMLDataModel
- class
YAHOO.ext.grid.XMLDataModel
- extends YAHOO.ext.grid.LoadableDataModel
This is an implementation of a DataModel used by the Grid. It works
with XML data.
Example schema from Amazon search:
var schema = {
tagName: 'Item',
id: 'ASIN',
fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup']
};
Defined in XMLDataModel.js
|
Method Summary
* Parameter types in italic indicate optional parameters
|
Number
|
addRow(<String> id, <Array> cellValues)
Adds a row to this DataModel and syncs the XML document
|
XMLNode
|
createNode(<XMLDocument> xmlDoc, id, <Array> colData)
Override this method to define your own node creation routine for when new rows are added.
|
Object
|
getDocument()
|
Object
|
getNamedValue(node, name, defaultValue)
Convenience function looks for value in attributes, then in children tags - also
normalizes namespace matches (ie matches ns:tag, FireFox matches tag and not ns:tag).
|
Object
|
getNode(rowIndex)
|
Number
|
getRowId(<Number> rowIndex)
Overrides getRowId in DefaultDataModel to return the ID value of the specified node.
|
Number
|
insertRow(<Number> index, <String> id, <Array> cellValues)
Inserts a row into this DataModel and syncs the XML document
|
void
|
loadData(<XMLDocument> doc, <Function> callback, <Boolean> keepExisting, <Number> insertIndex)
Overrides loadData in LoadableDataModel to process XML
|
void
|
removeRow(<Number> index)
Removes the row from DataModel and syncs the XML document
|
void
|
setNamedValue(node, name, value)
Convenience function set a value in the underlying xml node.
|
void
|
setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)
Overrides DefaultDataModel.setValueAt to update the underlying XML Document
|
| Methods inherited from class YAHOO.ext.grid.LoadableDataModel |
isPaged, getTotalRowCount, getPageSize, getTotalPages, initPaging, loadPage, sort, load, fireLoadException, fireLoadEvent, addPreprocessor, getPreprocessor, removePreprocessor, addPostprocessor, getPostprocessor, removePostprocessor
|
xml
Object xml
YAHOO.ext.grid.XMLDataModel
YAHOO.ext.grid.XMLDataModel(<Object> schema, <XMLDocument> xml)
Parameters:
schema - The schema to use
xml - An XML document to load immediately
addRow
Number addRow(<String> id, <Array> cellValues)
Adds a row to this DataModel and syncs the XML document
Parameters:
id - The id of the row, if null the next row index is used
cellValues - The cell values for this row
createNode
XMLNode createNode(<XMLDocument> xmlDoc, id, <Array> colData)
Override this method to define your own node creation routine for when new rows are added.
By default this method clones the first node and sets the column values in the newly cloned node.
Parameters:
xmlDoc - The xml document being used by this model
colData - The column data for the new node
getDocument
Object getDocument()
getNamedValue
Object getNamedValue(node, name, defaultValue)
Convenience function looks for value in attributes, then in children tags - also
normalizes namespace matches (ie matches ns:tag, FireFox matches tag and not ns:tag).
getNode
Object getNode(rowIndex)
getRowId
Number getRowId(<Number> rowIndex)
Overrides getRowId in DefaultDataModel to return the ID value of the specified node.
insertRow
Number insertRow(<Number> index, <String> id, <Array> cellValues)
Inserts a row into this DataModel and syncs the XML document
Parameters:
index - The index to insert the row
id - The id of the row, if null the next row index is used
cellValues - The cell values for this row
loadData
void loadData(<XMLDocument> doc, <Function> callback, <Boolean> keepExisting, <Number> insertIndex)
Overrides loadData in LoadableDataModel to process XML
Parameters:
doc - The document to load
callback - (optional) callback to call when loading is complete
keepExisting - (optional) true to keep existing data
insertIndex - (optional) if present, loaded data is inserted at the specified index instead of overwriting existing data
removeRow
void removeRow(<Number> index)
Removes the row from DataModel and syncs the XML document
Parameters:
index - The index of the row to remove
setNamedValue
void setNamedValue(node, name, value)
Convenience function set a value in the underlying xml node.
setValueAt
void setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)
Overrides DefaultDataModel.setValueAt to update the underlying XML Document
Documentation generated by
JSDoc on Sat Oct 14 06:07:10 2006