Okay I'm just trying to duplicate the Grid Page live example locally. The select box is fine. It populates from the AllRawJson.js file. I downloaded the JSFiddle and added Knockout 3.2 and knockout simpleGrid.js files. Can anyone Help?
Thx
Henry
Here's my Error Message...
Uncaught ReferenceError: Unable to process binding "value: function (){return id }"
Message: id is not defined
VM65:1 Uncaught ReferenceError: id is not defined
HTM/Javascript....
<!DOCTYPE html>
<html>
<head>
<title>Page Grid</title>
<script type="text/javascript" src="knockout-3.2.0.js"></script>
<script type="text/javascript" src="knockout.simpleGrid.3.0.js"></script>
<script>
function titleMoney() {
var rev1 = this;
// titleMoney = function() {
;
for (var i = 0; i < rev1.revenue().length; i++) {
if (rev1.revenue()[i].songTitle() === selectedSongTitle) {
//page Grid here
this.gridViewModel = new ko.simpleGrid.viewModel({
data: this.items,
columns: [
{ headerText: "Account Name", rowText: rev1.revenue()[i].accountName() },
{ headerText: "Amount", rowText: rev1.revenue()[i].amount() },
{ headerText: " Date", rowText: rev1.revenue()[i].date() },
],
pageSize: 4
});
} //for next
} //function end
</script>
</head>
<body>
<!--ul data-bind="foreach: title">
<li data-bind="click: $parent.selectPerson, text: songTitle"></li>
</ul-->
<!-- ko if: selectedPerson -->
<span data-bind="text: selectedPerson().songTitle"></span>
<!-- /ko -->
<td><select data-bind="options: title,
optionsText: 'songTitle',
value: id,
optionsCaption:'--Select Title--'">,
value: selectedSongTitle
</select>
</td>
</tr>
<button data-bind='click: titleMoney'>Get My Money!</button>
<div class='liveExample'>
<div data-bind='simpleGrid: gridViewModel'> </div>
<button data-bind='click: addItem'>
Add item
</button>
<button data-bind='click: sortByName'>
Sort by name
</button>
<button data-bind='click: jumpToFirstPage, enable: gridViewModel.currentPageIndex'>
Jump to first page
</button>
</div>
</body>
<script type="text/javascript" src="AllRawJson.js"></script>
</html>
AllRawJson.js
function titleModel() {
var self = this;
self.title = [
{ songTitle: "This Shit is Working", copyrightNumber: "SR 48395", copyrightDate: "01-20-1999", songType: "Jazz", lyrics: "Paid Me My Money"},
{ songTitle: "Muir Woods Suite", copyrightNumber: "SR 48395", copyrightDate: "01-20-1999", songType: "Jazz", lyrics: "Paid Me My Money"},
{ songTitle: "Willa and HenP", copyrightNumber: "PA 2899", copyrightDate: "01-20-1999", songType: "Classical", lyrics: "Erika Believes in Me"},
{ songTitle: "Its All About Erika", copyrightNumber: "SR 20098", copyrightDate: "01-20-1999", songType: "Funk", lyrics: "Meta is the Way"}
];
self.selectedPerson = ko.observable();
self.selectPerson = function() {
// this = the object in people corresponding to the name we clicked on
self.selectedPerson(this);
};
}
ko.applyBindings(new titleModel());
function revenueModel() {
var self = this;
self.revenue = [
{ songTitle: "This Shit is Working", accountName: "ASCAP", amount: 443.66, date: "01-20-1999"},
{ songTitle: "Wila and Henp", accountName: "NBC TV", amount: 284233.90, date: "10-23-2000"},
{ songTitle: "This Shit is Working", accountName: "ASCAP", amount: 443.66, date: "01-20-1999"},
{ songTitle: "Wila and Henp", accountName: "NBC TV", amount: 284233.90, date: "10-23-2000"},
{ songTitle: "This Shit is Working", accountName: "ASCAP", amount: 443.66, date: "01-20-1999"},
{ songTitle: "Wila and Henp", accountName: "NBC TV", amount: 284233.90, date: "10-23-2000"},
{ songTitle: "Its All About Erika", accountName: "Harry Fox", amount: 29668, date: "02-20-2003"}
];
self.selectedPerson = ko.observable();
self.selectPerson = function() {
// this = the object in people corresponding to the name we clicked on
self.selectedPerson(this);
};
}
ko.applyBindings(new revenueModel());