Hello
Firstly, excuse any errors in the code. JQuery is new to me.
The data is coming back from the server in Json(result). Now I need to bind it to the grid (and obviously the way I am trying to do it is not working). Do I need to specify a schema for the dataSource? Can this not be "read" from the Json data?
Firstly, excuse any errors in the code. JQuery is new to me.
The data is coming back from the server in Json(result). Now I need to bind it to the grid (and obviously the way I am trying to do it is not working). Do I need to specify a schema for the dataSource? Can this not be "read" from the Json data?
<script>
$(document).ready(function () {
function CallParameters() {
this.StringDate;
this.Contractid;
this.InvoiceNo;
}
function GetDays() {
var url = "/Invoice/GetBusinessDays/";
var callParameters = new CallParameters();
callParameters.StringDate = $("#monthpicker").val();
callParameters.ContractID = $("#ContractID").val();
callParameters.InvoiceNo = $("#InvoiceNumber").val();
$.post(url, callParameters, function (data, textStatus) {
GetDaysCallComplete(data);
});
}
function GetDaysCallComplete(result) {
var ds = new kendo.data.DataSource({
transport: {
read: {
dataType: "json"
}
}
});
ds.data.add(result);
$("#grid").data("kendoGrid").dataSource.read();
}
$("#bizdays").click(function (event) {
event.preventDefault();
GetDays();
});
// create DatePicker from input HTML element
$("#invoicedate").kendoDatePicker({
value: new Date(),
format: "dd MMM yyyy",
animation: {
open: {
effects: "fadeIn", duration: 300, show: true
}
}
});
$("#monthpicker").kendoDatePicker({
value: new Date(),
// defines the start view
start: "year",
// defines when the calendar should return date
depth: "year",
// display month and year in the input
format: "MMMM yyyy"
});
$("#grid").kendoGrid({
autoBind: false,
dataSource: ds,
height: 500,
scrollable: true,
selectable: true,
columns: [{
field: "RowDetail",
width: 90,
title: "Detail"
}, {
field: "RowQty",
width: 90,
title: "Qty"
}, {
width: 90,
field: "ItemPrice",
title: "Item Price"
}, {
width: 90,
field: "RowTotal",
title: "Row Total"
}
]
});
});
</script>
$(document).ready(function () {
function CallParameters() {
this.StringDate;
this.Contractid;
this.InvoiceNo;
}
function GetDays() {
var url = "/Invoice/GetBusinessDays/";
var callParameters = new CallParameters();
callParameters.StringDate = $("#monthpicker").val();
callParameters.ContractID = $("#ContractID").val();
callParameters.InvoiceNo = $("#InvoiceNumber").val();
$.post(url, callParameters, function (data, textStatus) {
GetDaysCallComplete(data);
});
}
function GetDaysCallComplete(result) {
var ds = new kendo.data.DataSource({
transport: {
read: {
dataType: "json"
}
}
});
ds.data.add(result);
$("#grid").data("kendoGrid").dataSource.read();
}
$("#bizdays").click(function (event) {
event.preventDefault();
GetDays();
});
// create DatePicker from input HTML element
$("#invoicedate").kendoDatePicker({
value: new Date(),
format: "dd MMM yyyy",
animation: {
open: {
effects: "fadeIn", duration: 300, show: true
}
}
});
$("#monthpicker").kendoDatePicker({
value: new Date(),
// defines the start view
start: "year",
// defines when the calendar should return date
depth: "year",
// display month and year in the input
format: "MMMM yyyy"
});
$("#grid").kendoGrid({
autoBind: false,
dataSource: ds,
height: 500,
scrollable: true,
selectable: true,
columns: [{
field: "RowDetail",
width: 90,
title: "Detail"
}, {
field: "RowQty",
width: 90,
title: "Qty"
}, {
width: 90,
field: "ItemPrice",
title: "Item Price"
}, {
width: 90,
field: "RowTotal",
title: "Row Total"
}
]
});
});
</script>