Skip to content

anonymous /YUI_JSON_Datatable_Problem.htm
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>JSON Datatable Proof of Concept</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/element/element-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/datasource/datasource-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/datatable/datatable-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/connection/connection-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/json/json-min.js"></script>
<style type="text/css">
#container {height:15em;}
myContainer { background-color:Gray;}
</style>
<script type="text/javascript">
YAHOO.util.Event.addListener("myButton", "click", function() {
var myConfigs = {};
var myColumnDefs = [
{key:"EmpId"},
{key:"Name"},
{key:"Designation"},
{key:"Department"},
{key:"Country"}
];
var myDataSource = new YAHOO.util.DataSource('http://localhost:1715/JSONService/JSONService.svc/Charm?');
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.connMethodPost = true;
myDataSource.responseSchema = {
resultNode: "Rows",
fields : ["EmpId", "Name" ,"Designation", "Department" , "Country"]
};
var myDataTable = new YAHOO.widget.DataTable("myContainer", myColumnDefs, myDataSource, myConfigs);
return {
oDS: myDataSource,
oDT: myDataTable
};
});
</script>
</head>
<body class="yui-skin-sam">
<form id="form1" action="#">
<input type="button" id="myButton" value="Get Data" />
<div id="myContainer"></div>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.