or
<
script
>
$(function () {
$("#tCode").kendoAutoComplete({
dataTextField: "Code",
dataSource: [ { Code:"10", Name:"Jeffrey" }, { Code:"11", Name:"Jack" }]
});
});
</
script
>
<
input
id
=
"tCode"
/><
input
id
=
"tName"
/>
if
(separator) {
text = replaceWordAtCaret(caretPosition(that.element[0]), that.value(), text, separator);
}
//2012-01-18 by Jeffrey Lee
//when item is selected, trigger select event with data as argument
if
($.isFunction(that.options.select))
that.options.select(data);
that.value(text);
that.current(li.addClass(SELECTED));
<script>
$(
function
() {
$(
"#tCode"
).kendoAutoComplete({
dataTextField:
"Code"
,
dataSource: [{ Code:
"10"
, Name:
"Jeffrey"
}, { Code:
"11"
, Name:
"Jack"
}],
//new "select" event triggered when hint item is selected
select:
function
(data) { $(
"#tName"
).val(data.Name); }
});
});
</script>
<input id=
"tCode"
/><input id=
"tName"
/>
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>Test</
title
>
<
script
src
=
"source/jquery.min.js"
></
script
>
<
script
src
=
"source/kendo.all.js"
></
script
>
<
script
src
=
"scripts.js"
></
script
>
<
link
href
=
"styles/kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"styles/kendo.default.min.css"
rel
=
"stylesheet"
/>
</
head
>
<
body
>
<
div
class
=
"main"
>
<
div
class
=
"header"
>
<
img
src
=
"styles/image/kendo-logo-big.png"
class
=
"logo"
/>
<
h1
>Kendo UI Grid</
h1
>
</
div
>
<
div
id
=
"grid"
>
<
table
id
=
"weapons"
>
<
tr
>
<
th
data-field
=
"name"
>Name</
th
>
<
th
data-field
=
"desc"
>Description</
th
>
</
tr
>
</
table
>
</
div
>
</
div
>
</
body
>
</
html
>
$(document).ready(
function
() {
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"http://dhpl.comuf.com/json.php"
,
dataType:
"json"
}
},
schema: {
data:
"results"
}
});
$(
"#weapons"
).kendoGrid({
dataSource: dataSource
});
});
<?php
header(
"Content-type: application/json"
);
print(
'{ "results" : [{ "name" : "Name1", "desc" : "Desc1" }, { "name" : "Name2", "desc" : "Desc2" }] } '
);
?>
Url http://dhpl.comuf.com/json.php it's working if you want to check.
Could anybody help me <
table
id
=
"grid"
>
<
thead
>
<
tr
>
<
th
data-field
=
"one"
>One</
th
>
<
th
data-field
=
"two"
>Two</
th
>
<
th
data-field
=
"three"
>Three</
th
>
</
tr
>
</
thead
>
<
tbody
>
<
tr
>
<
td
>1</
td
><
td
>2</
td
><
td
>3</
td
>
</
tr
>
<
tr
>
<
td
>1</
td
><
td
>2</
td
><
td
>3</
td
>
</
tr
>
</
tbody
>
</
table
>
<
script
>
$(document).ready(function() {
var element = $("#grid").kendoGrid({
height: 450,
sortable: true,
detailInit: detailInit
});
});
function detailInit(e) {
}
</
script
>