or
$(document).ready(function () {
var crudServiceBaseUrl = '/participant',
dataSource = source,
batch: true,
pageSize: 30,
schema: {
model: {
id: "id",
fields: {"id":{"editable":false,"type":"number","label":"ID"},"first_name":{"type":"string","label":"First Name"},"last_name":{"type":"string","label":"Last Name"},"birthdate":{"type":"date","label":"Birthdate"},"social_security_number":{"type":"string","label":"Social Security Number"},"smoker":{"type":"boolean","label":"Smoker"},"vegetarian":{"type":"boolean","label":"Vegetarian"},"miscelaneous":{"type":"string","label":"Miscelaneous"},"active":{"type":"boolean","label":"Active"},"blacklist_comment":{"type":"string","label":"Blacklist Comment"}} }
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
width: 1000,
toolbar: ["create"],
columns: [{"title":"ID","field":"id"},{"title":"First Name","field":"first_name"},{"title":"Last Name","field":"last_name"},{"title":"Birthdate","field":"birthdate"},{"title":"Social Security Number","field":"social_security_number"},{"title":"Smoker","field":"smoker"},{"title":"Vegetarian","field":"vegetarian"},{"title":"Miscelaneous","field":"miscelaneous"},{"title":"Active","field":"active"},{"title":"Blacklist Comment","field":"blacklist_comment"},{"command":"destroy","filterable":false},{"command":"edit","filterable":false}],
editable: "popup",
selectable: "row",
pageable: true,
sortable: true,
groupable: true,
filterable: true,
});
});
function
createGridMission(a)
{
var
element = $(
"#gridF01"
).kendoGrid({
dataSource: {
data: a,
pageSize: 6,
serverPaging:
true
,
serverSorting:
true
},
height: 450,
sortable:
true
,
pageable:
true
,
detailInit: detailInit,
columns: [
{
field:
"mission"
,
title:
"Mission"
}
]
});
function
detailInit(e) {
$(
"<div/>"
).appendTo(e.detailCell).kendoGrid({
dataSource: {
transport: {
read: {
url:
"/Mob/Client/Tableau?mission="
+ a +
"&id="
+ $(
"#hidCodeClient"
).val(),
dataType:
"json"
}
},
serverPaging:
true
,
serverSorting:
true
,
serverFiltering:
true
,
pageSize:6,
filter: { field:
"mission"
, operator:
"eq"
, value: e.data.mission }
},
scrollable:
false
,
sortable:
true
,
pageable:
true
,
columns: [
{ field:
"periode"
, title:
"Période"
},
{ field:
"debut"
, title:
"Début"
},
{ field:
"fin"
, title:
"Fin"
},
{ field:
"quantite"
, title:
"Quantité"
},
{ field:
"production"
, title:
"Production"
},
{ field:
"facturation"
, title:
"Facturation"
},
{ field:
"solde"
, title:
"Solde"
},
{ field:
"dateSolde"
, title:
"Date solde"
}
]
});
}
}
"editor"
:
function
(container, options) {
$(
'<input id="'
+ options.field +
'" />'
)
.appendTo(container)
.kendoDropDownList({
dataTextField:
'text'
,
dataValueField:
'value'
,
dataSource: {
change:
function
(e) {
var
item =
null
;
$(
'#'
+options.field).data(
'kendoDropDownList'
).ul.children().each(
function
(idx, elem) {
if
($(elem).html() == options.model.rel_type) item = $(elem);
});
console.log($(item).html());
// does not select anything even tho console.log() proves that it is the correct element
$(
'#'
+options.field).data(
'kendoDropDownList'
).select($(item));
},
transport: {
read: {
url:
'/relationdata/relation/relType'
,
dataType:
'json'
}
}
}
});
}}
Hi, We are using the following code but not able to populate the Grid. Our Json is in the form of string . the json structure is something like this. "d : [{"ID":"1","Name":"Umesh"}]"
$(document).ready(
function () {
$(
"#customergriddiv").kendoGrid
({
height: 400,
pageable: true,
scrollable: false,
sortable: true,
columns: [{ field: "ID", title: "ID" }, { field: "Name", title: "Name"}],
datasource: {
transport: {
read: {
type: "POST",
url: "GetJson.asmx/GetCustomers",
contentType: 'application/json; charset=utf-8',
dataType: "json"
}
},
schema: {
data:
"d"
}
, pageSize: 10
}
});
 });
<
div id="customergriddiv"></div>