Last active
December 27, 2015 03:39
-
-
Save butlermh/7260966 to your computer and use it in GitHub Desktop.
Using YUI to display data.taipei.gov.tw dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<title>Displaying a remote JSON DataSource in a DataTable</title> | |
<body class="yui3-skin-sam"> | |
<div id="datatable"></div> | |
<script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js"></script> | |
<script> | |
YUI().use('datatable', 'datasource-get', 'datasource-io', 'datasource-jsonschema', function (Y) { | |
var src = new Y.DataSource.Get({ | |
source: 'http://data.taipei.gov.tw/opendata/apply/json/NzRBNTc0NDUtMjMxMi00RTk1LTkxMjgtNzgzMzU5MEQzRDc3' | |
}); | |
src.plug(Y.Plugin.DataSourceJSONSchema, { | |
schema: { | |
resultListLocator: 'results.json.json', | |
resultFields: [ | |
'name', | |
'district' | |
] | |
} | |
}); | |
var table = new Y.DataTable({ columns: [ | |
'name', | |
'district' | |
] | |
}); | |
table.plug(Y.Plugin.DataTableDataSource, { datasource: src }); | |
table.render('#datatable'); | |
table.datasource.load({ request: '?per_page=10' }); | |
}); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Mark,
I have looked into this issue, and here is the patch might work:
In redir.php: