parse()
loads a collection of items from a local source
parse(data: object[] | string, driver?: object | string): void;
Parameters:
data: array | string
- the data to loaddriver: object | string
- optional, DataDriver or type of data ("json", "csv", "xml"), "json" by default
Example
// loads data into the toolbar from the JSON array
toolbar.data.parse([
{
type: "button",
icon: "dxi-plus",
value: "Tania",
count: 11
},
{
type: "separator"
},
{
type: "navItem",
icon: "",
value: "Language",
items: [
{
icon: "dxi-printer",
value: "English"
},
{
icon: "dxi-printer",
value: "日本語"
}
]
}
]);
// loads data into the toolbar from the XML string
toolbar.data.parse("<root>"
+"<item><type>button</type><icon>dxi-plus</icon><value>Tania</value>"
+"<count>11</count></item>"
+"<item><type>separator</type></item>"
+"<item><type>navItem</type><value>Language</value><items>"
+"<item><icon>dxi-printer</icon><value>English</value></item>"
+"<item><icon>dxi-printer</icon><value>日本語</value></item>"
+"</root>","xml");
info
Please note that if you specify the id
fields in the tree collection, their values should be unique. You can also omit the id
fields in the tree collection. In this case they will be generated automatically.