datatable-dsio-source.mustache revision c7aeb2c8479a339ddcc01cf5973c31ddd6277b0d
0N/A<style scoped>
4002N/A/* custom styles for this example */
0N/A.example .yui3-datatable {
0N/A margin-bottom: 1em;
0N/A}
0N/A
2362N/A/* css to counter global site css */
0N/A.example table {
2362N/A width: auto;
0N/A}
0N/A.example caption {
0N/A display: table-caption;
0N/A}
0N/A.example th,
0N/A.example td {
0N/A text-transform: none;
0N/A border: 0 none;
0N/A}
0N/A</style>
0N/A
2362N/A<div id="chinese" class="dt-example"></div>
2362N/A
2362N/A<script>
0N/AYUI().use("datasource-io", "datasource-xmlschema", "datatable-datasource", function (Y) {
0N/A var ds = new Y.DataSource.IO({
0N/A source:"../assets/datatable/ylocal.xml?"})
0N/A .plug(Y.Plugin.DataSourceXMLSchema, {
0N/A schema: {
0N/A resultListLocator: "Result",
0N/A resultFields: [
0N/A {
0N/A key:"Title",
0N/A locator:"*[local-name() ='Title']"
0N/A },
0N/A {
0N/A key:"Phone",
0N/A locator:"*[local-name() ='Phone']"
0N/A },
0N/A {
0N/A key:"Rating",
0N/A locator:"*[local-name()='Rating']/*[local-name()='AverageRating']",
0N/A // The data contains "NaN" for unrated restaurants
0N/A parser: function (val) {
0N/A return isNaN(val) ? '(none)' : val;
0N/A }
0N/A }
0N/A ]
0N/A }
0N/A }),
0N/A dt = new Y.DataTable({
0N/A columns: ["Title", "Phone", "Rating"],
0N/A summary:"Chinese restaurants near 98089",
0N/A caption:"Table with XML data from same-domain script"
2301N/A }).plug(Y.Plugin.DataTableDataSource, {
2301N/A datasource: ds,
2301N/A initialRequest:"zip=94089&query=chinese"
2301N/A }).render("#chinese");
2301N/A
2301N/A dt.datasource.load();
0N/A});
0N/A</script>
0N/A