<script>
function createChart() {
var chartData = [
{ X: "1" , '1':15.7, '2': 0, '3': 0, '4': 0, '5':0},
{ X: "2" , '2':16.7, '1': 0, '3': 0, '4': 0, '5':0},
{ X: "3" , '3':20, '1': 0, '2': 0, '4': 0, '5':0},
{ X: "4" , '4':23.5, '1': 0, '2': 0, '3': 0, '5':0},
{ X: "5" , '5':26.6, '1': 0, '2': 0, '3': 0, '4':0}
];
$("#chart").kendoChart({
dataSource: {
data: chartData
},
theme: $(document).data("kendoSkin") || "default",
title: {
text: "Internet Users"
},
legend: {
position: "bottom"
},
seriesDefaults: {
type: "column",
stack: true
},
series:
[
{ field:"1", name: "1", color:"red" },
{ field:"2", name: "2" },
{ field:"3", name: "3" },
{ field:"4", name: "4" },
{ field:"5", name: "5" }
],
valueAxis: {
labels: {
format: "{0}%"
}
},
categoryAxis: {
field:'X'
},
tooltip: {
visible: true,
format: "{0}%"
}
});
}
$(document).ready(function() {
setTimeout(function() {
createChart();
// Initialize the chart with a delay to make sure
// the initial animation is visible
}, 400);
$(document).bind("kendo:skinChange", function(e) {
createChart();
});
});
</script>
public partial class GetAirport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(GetAiport(Request.QueryString["apt"]));
}
public string GetAiport(string term)
{
using (D4AgencyModelDataContext dc = new D4AgencyModelDataContext())
{
var citta = (from city in dc.d4agency_Airport_Cities
join c in dc.d4agency_Countries
on city.Paese equals c.Code
where city.Airport.StartsWith(term) && (city.TypeApt.Equals('A') || city.TypeApt.Equals('C'))
select new
{
city.CodAirport, city.Airport , city.City , c.Description , city.Stato
});
string jsonStr = JsonConvert.SerializeObject(citta);
return jsonStr;
}
}
}
Hello i have a porblem whit the autocomplete
in my page :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="D4Agency.Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="/Jquery/Kendo/styles/kendo.common.css" rel="stylesheet"/>
<link href="/Jquery/Kendo/styles/kendo.default.css" rel="stylesheet"/>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<script src="/Jquery/Kendo/js/jquery.min.js" type="text/javascript"></script>
<script src="/Jquery/Kendo/js/Kendo.all.min.js" type="text/javascript"></script>
<script src="/Jquery/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function()
{
$("#txtFrom").kendoAutoComplete(
{
minLength: 3,
filter: 'contains',
severFiltering: true,
serverPaging: true,
dataTextField: "CodAirport",
dataSource:
new kendo.data.DataSource(
{
type: "json",
transport: {
read: "/Search/GetAirport.aspx",
parameterMap: function() {
return {
apt: $("#txtFrom").data("kendoAutoComplete").value()
};
}
}
})
});
})
</script>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server" ID="txtFrom" Width="220px" />
</div>
</form>
</body>
</html>
the sistme send me this error :
function anonymous(d, __f, __o) {
return (d.CodAirport.toLowerCase().indexOf('lin') >= 0)
}
Is anyone expiencing the problem when using the Metro theme that textboxes seem to get some weird padded border. When adding an autocomplete, it gets even worse.
I'm not applying any CSS at all. The sample attached was a new site. The top image is when hovered over.
Here is the code:
<
form
id
=
"frmSearch"
method
=
"get"
action
=
"@Href("
~/collections/search")"
class
=
"btnSearch"
>
<
input
id
=
"txtSearch"
type
=
"text"
name
=
"q"
placeholder
=
"@defaultValue"
class
=
"k-textbox"
style
=
"width:40%;"
required />
<
button
class
=
"k-button dark"
id
=
"btnSearch"
>
search</
button
>
</
form
>
Here is the JS:
// Search box.
$(
"#txtSearch"
).kendoAutoComplete({
change: onSearchClick,
minLength: 3,
dataTextField:
"title"
,
delay: 400,
dataSource:
new
kendo.data.DataSource({
type:
"json"
,
pageSize: 10,
// Required to prevent caching.
serverFiltering:
true
,
// Required to prevent caching.
serverPaging:
true
,
// Required to prevent caching.
transport: {
read: getRootDomain() +
"/findTitles"
,
parameterMap:
function
(options) {
return
$.extend(options, {
title: $(
"#txtSearch"
).data(
"kendoAutoComplete"
).value()
});
}
}
})
});
// Initialize and configure the input validator for the search box (on collection page).
var
validator = $(
"#frmSearch"
).kendoValidator({
rules: {
custom:
function
(input) {
// Prevent anything under 3 characters from being allowed.
return
input.val().length > 2;
}
},
messages: {
custom:
"You need 3 or more charactors"
,
// Shows when <3 character is entered.
required:
"Oops, you forgot me!"
// Shows when the search box is left blank.
}
}).data(
"kendoValidator"
);
$(
"#btnSearch"
).click(
function
() {
if
(validator.validate() ==
false
) {
}
});
EDIT: also the documentation for the validator regarding the SPAN tag to fix alignment does not work in the above situation.
The attached image icon on this post says it is a GIF when it is a PNG
I'm stuck with a data source and a grid. The data is to be shown in a grid but I can't get it too work.
<
div
id
=
"grid"
></
div
>
<
script
>
$(document).ready(function() {
var d={"count":0,"subTotal":0,"items":{"sku":"dvdwinf","title":"Doctor Who:
Inferno","price":19.95,"format":"DVD","url":"drwho/doctor-who-inferno/dvdwinf","quantity":1}}
$("#grid").kendoGrid({
dataSource: {
data: d,
pageSize: 10
},
schema: {
data: "items"
},
height: 250,
scrollable: true,
sortable: true,
pageable: true,
columns: [
{
field: "sku",
title: "First Name"
},
{
field: "title"
}
]
});
});
</
script
>
The data to show will be a from a web service but for now it is hot-wired in there for testing. The JSON object is properly formatted and the EXACT data is used with a jQuery AJAX request elsewhere and used just fine. Any ideas?