Hi, new to Kendo . . .
From the View:
function InitGrid() {
$("#grid").kendoGrid({
dataSource: oRemoteDataSource,
edit: EditMe,
save: SaveMe,
error: function (e) {
alert(e.responseText);
},
pageable: {
numeric: true,
refresh: true,
pageSizes: [3, 6, 10],
previousNext: true,
input: false,
info: false
},
sortable: true,
selectable: "row",
id: "Code",
schema: {
model: {
id: "Code",
fields: {
"Name": { editable: false },
"Code": { nullable: true },
"IsPrecontract": { editable: false },
"IsActive": { editable: false }
}
}
},
columns: [
{ field: "Name", title: "Name", width: "450px" },
{ field: "Code", title: "Code", width: "40px", editable: false },
{ field: "IsPrecontract", title: "IsPrecontract", width: "80px" },
{ field: "IsActive", title: "IsActive", width: "80px" },
{ command: ["destroy"], title: " ", width: "80px" }
],
toolbar: [
"create",
{ name: "save", text: "Save This Record" }
],
editable: {
update: true,
destroy: false,
confirmation: "Are you sure you want to remove this category?"
},
});
}
Now the data source:
function InitDataSource() {
oRemoteDataSource = new kendo.data.DataSource({
type: "odata",
pageSize: 10,
transport: {
read: function (options) {
$.ajax({
url: "/KendoGrid/MasterCategories_Read",
data: options.data, // the "data" field contains paging, sorting, filtering and grouping data
success: function (result) {
// alert(JSON.stringify(result));
$("#json").html(JSON.stringify(result));
options.success(result);
}
});
},
update: {
url: "/KendoGrid/MasterCategories_Update",
type: "POST"
}
}
});
}
Now my JSON from the Controller, shows up ok . . . but not in the grid, only on my page in a div right underneath the empty grid that has only the column names showing: (I formatted the top few here for easy reading)
{"Data":[
{"Name":"Hardwood Stairs","Code":"39","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Siding","Code":"10","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Fireplace","Code":"26","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Stair Railing","Code":"40","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Tile Accessories","Code":"25","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Interior Doors","Code":"36","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Hardware & Mirrors","Code":"31","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Permit, Fees and Insurance","Code":"01","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Job Clean-up","Code":"34","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Deck","Code":"12","IsPrecontract":"N","IsActive":"Y"},{"Name":"Countertops","Code":"29","IsPrecontract":"N","IsActive":"Y"},{"Name":"Rain Gutters","Code":"32","IsPrecontract":"N","IsActive":"Y"},{"Name":"Light Fixtures","Code":"20","IsPrecontract":"N","IsActive":"Y"},{"Name":"Entry Doors","Code":"13","IsPrecontract":"N","IsActive":"Y"},{"Name":"Damp Proofing","Code":"07","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Electrical","Code":"19","IsPrecontract":"N","IsActive":"Y"},{"Name":"Temporary Utilities","Code":"04","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Architecture & Engineering","Code":"03","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Paint","Code":"24","IsPrecontract":"N","IsActive":"Y"},{"Name":"Speciality Items","Code":"80","IsPrecontract":"N","IsActive":"Y"},{"Name":"Windows","Code":"15","IsPrecontract":"N","IsActive":"Y"},{"Name":"Drywall","Code":"22","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Electrical Features - Upgrade","Code":"42","IsPrecontract":"N","IsActive":"Y"},{"Name":"Garage Doors","Code":"14","IsPrecontract":"N","IsActive":"Y"},{"Name":"Foundation","Code":"06","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Insulation","Code":"21","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Cabinets","Code":"28","IsPrecontract":"N","IsActive":"Y"},{"Name":"Stone","Code":"23","IsPrecontract":"N","IsActive":"Y"},{"Name":"Trim Materials","Code":"37","IsPrecontract":"N","IsActive":"Y"},{"Name":"Design Ideas","Code":"00","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Appliances","Code":"30","IsPrecontract":"N","IsActive":"Y"},{"Name":"Central Vacuum","Code":"33","IsPrecontract":"N","IsActive":"Y"},{"Name":"Roofing","Code":"11","IsPrecontract":"N","IsActive":"Y"},{"Name":"Framing","Code":"08","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Lot Improvements","Code":"02","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Air Conditioning","Code":"18","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Heating and Ventilation","Code":"17","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Plumbing","Code":"16","IsPrecontract":"N","IsActive":"Y"},{"Name":"Closet Shelving","Code":"38","IsPrecontract":"N","IsActive":"Y"},{"Name":"Flooring","Code":"27","IsPrecontract":"N","IsActive":"Y"}],"Total":40,"AggregateResults":null,"Errors":null}
And this won't show up in the grid why exactly?
Thanks
From the View:
function InitGrid() {
$("#grid").kendoGrid({
dataSource: oRemoteDataSource,
edit: EditMe,
save: SaveMe,
error: function (e) {
alert(e.responseText);
},
pageable: {
numeric: true,
refresh: true,
pageSizes: [3, 6, 10],
previousNext: true,
input: false,
info: false
},
sortable: true,
selectable: "row",
id: "Code",
schema: {
model: {
id: "Code",
fields: {
"Name": { editable: false },
"Code": { nullable: true },
"IsPrecontract": { editable: false },
"IsActive": { editable: false }
}
}
},
columns: [
{ field: "Name", title: "Name", width: "450px" },
{ field: "Code", title: "Code", width: "40px", editable: false },
{ field: "IsPrecontract", title: "IsPrecontract", width: "80px" },
{ field: "IsActive", title: "IsActive", width: "80px" },
{ command: ["destroy"], title: " ", width: "80px" }
],
toolbar: [
"create",
{ name: "save", text: "Save This Record" }
],
editable: {
update: true,
destroy: false,
confirmation: "Are you sure you want to remove this category?"
},
});
}
Now the data source:
function InitDataSource() {
oRemoteDataSource = new kendo.data.DataSource({
type: "odata",
pageSize: 10,
transport: {
read: function (options) {
$.ajax({
url: "/KendoGrid/MasterCategories_Read",
data: options.data, // the "data" field contains paging, sorting, filtering and grouping data
success: function (result) {
// alert(JSON.stringify(result));
$("#json").html(JSON.stringify(result));
options.success(result);
}
});
},
update: {
url: "/KendoGrid/MasterCategories_Update",
type: "POST"
}
}
});
}
Now my JSON from the Controller, shows up ok . . . but not in the grid, only on my page in a div right underneath the empty grid that has only the column names showing: (I formatted the top few here for easy reading)
{"Data":[
{"Name":"Hardwood Stairs","Code":"39","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Siding","Code":"10","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Fireplace","Code":"26","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Stair Railing","Code":"40","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Tile Accessories","Code":"25","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Interior Doors","Code":"36","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Hardware & Mirrors","Code":"31","IsPrecontract":"N","IsActive":"Y"},
{"Name":"Permit, Fees and Insurance","Code":"01","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Job Clean-up","Code":"34","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Deck","Code":"12","IsPrecontract":"N","IsActive":"Y"},{"Name":"Countertops","Code":"29","IsPrecontract":"N","IsActive":"Y"},{"Name":"Rain Gutters","Code":"32","IsPrecontract":"N","IsActive":"Y"},{"Name":"Light Fixtures","Code":"20","IsPrecontract":"N","IsActive":"Y"},{"Name":"Entry Doors","Code":"13","IsPrecontract":"N","IsActive":"Y"},{"Name":"Damp Proofing","Code":"07","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Electrical","Code":"19","IsPrecontract":"N","IsActive":"Y"},{"Name":"Temporary Utilities","Code":"04","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Architecture & Engineering","Code":"03","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Paint","Code":"24","IsPrecontract":"N","IsActive":"Y"},{"Name":"Speciality Items","Code":"80","IsPrecontract":"N","IsActive":"Y"},{"Name":"Windows","Code":"15","IsPrecontract":"N","IsActive":"Y"},{"Name":"Drywall","Code":"22","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Electrical Features - Upgrade","Code":"42","IsPrecontract":"N","IsActive":"Y"},{"Name":"Garage Doors","Code":"14","IsPrecontract":"N","IsActive":"Y"},{"Name":"Foundation","Code":"06","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Insulation","Code":"21","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Cabinets","Code":"28","IsPrecontract":"N","IsActive":"Y"},{"Name":"Stone","Code":"23","IsPrecontract":"N","IsActive":"Y"},{"Name":"Trim Materials","Code":"37","IsPrecontract":"N","IsActive":"Y"},{"Name":"Design Ideas","Code":"00","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Appliances","Code":"30","IsPrecontract":"N","IsActive":"Y"},{"Name":"Central Vacuum","Code":"33","IsPrecontract":"N","IsActive":"Y"},{"Name":"Roofing","Code":"11","IsPrecontract":"N","IsActive":"Y"},{"Name":"Framing","Code":"08","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Lot Improvements","Code":"02","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Air Conditioning","Code":"18","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Heating and Ventilation","Code":"17","IsPrecontract":"Y","IsActive":"Y"},{"Name":"Plumbing","Code":"16","IsPrecontract":"N","IsActive":"Y"},{"Name":"Closet Shelving","Code":"38","IsPrecontract":"N","IsActive":"Y"},{"Name":"Flooring","Code":"27","IsPrecontract":"N","IsActive":"Y"}],"Total":40,"AggregateResults":null,"Errors":null}
And this won't show up in the grid why exactly?
Thanks