Hi,
im using mvc to bind my autocomplete list and use it,to do so,my controller is like:
public Jsonresult Index()
{
//List of parks and turbines while searching
var turbineWindparkList=(from d in DB.Accessinfo
select new OverViewAutoComeplete {
ParkName=d.windpark_name,
TurbineName=d.turbine_name
}).Take(10).ToList();
return Json(turbineWindparkList, JsonRequestBehavior.AllowGet);
}
in my view :
<div><input id="inputAutoComplete" /></div>
<script type="text/javascript">
@(Html.Kendo().AutoComplete()
.Name("inputAutoComplete") //The name of the AutoComplete is mandatory. It specifies the "id" attribute of the widget.
.DataTextField("ParkName") //Specify which property of the Product to be used by the AutoComplete.
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Index", "Overview"); //Set the Action and Controller names.
})
.ServerFiltering(true); //If true, the DataSource will not filter the data on the client.
})
)
i dont know whats wrong with my controller which i cant reach to view on page load,and even if i use Actionresult to reach view,i get javascript error on the part razor command
Is there any way to detect an event AFTER an item has been added to a ListBox? The existing add event fires before the item is added.
My use case is that I have two connected ListBoxes. The second listbox contains a template that I need to run some jQuery in to modify the contents based on the item data, so the item needs to have been created before the script is run?
I have a drop down that responds to type-ahead. If I have a list of items 'Aitem, Bitem, Citem' and I type in the dropdown 'C' I get the input box filled in with 'Citem'. That works just fine. Is what I want is if 'Citem' is in the drop down list and focus is lost an 'automatic' selection occurs. From various documentation I have come up with
var wrapper = kendoDropDownList.wrapper;
wrapper.blur(function (e) {
// What goes here?
});
I have found that this function does get called when I lose focus and the argument 'e' is not undefined. But I am not sure how to get what is in the input box currently or a reference to the dropdown options. Any idea how I would do that?
Thank you.
I have a view that has several tabs. Each tab has a Telerik MVC grid on it. The grid on the first tab displays a scroll bar as it should, but the grids on the other tabs do not display the scroll bar unless I reload the grid when visible or click on "Cancel Changes" or "Clear Filters". I have tried the $("#MyGrid").getKendoGrid()._rowHeight = null; suggestion, but it did not work and I do not want to reload the grid each time the user navigates to the tab or to grammatically click the Cancel Changes or Clear Filters buttons as those are hacky solutions.
The grids use scrollable.Virtual(true) and scrollable.Height("auto").
Is there something I can call in my javascript when the tab is selected and the grid is visible to cause the scroll bars to appear other then what I have previously mentioned?
Thanks.
I have a two Switch widgets on my page and have a change event setup for one of them. In the change function i'm trying to get a reference to the other switch on the page to see if it is checked. All I get is 'Undefined'.
<
div
class
=
"col-md-6"
>
<
div
class
=
"form-group pt-2"
>
@(Html.Kendo().Switch()
.Name("Immediate")
.Messages(c => c.Checked("YES").Unchecked("NO"))
)
<
label
for
=
"reportable"
>Save changes immediately</
label
>
</
div
>
<
div
class
=
"form-group"
>
@(Html.Kendo().Switch()
.Name("Scheduled")
.Messages(c => c.Checked("YES").Unchecked("NO"))
.Events(e => e.Change("onScheduledChange"))
)
<
label
for
=
"history"
>Schedule/Back-Date Changes</
label
>
</
div
>
</
div
>
and here's my JS:
<
script
>
function onScheduledChange(e) {
var immediateSwitch = $("#Immediate").checked;
if (e.checked) {
//alert("scheduled is checked");
alert(immediateSwitch);
}
}
</
script
>
immediateSwitch returns undefined.
I've also tried this:
<
script
>
function onScheduledChange(e) {
var immediateSwitch = $("#Immediate").data("kendoSwitch");
if (e.checked) {
//alert("scheduled is checked");
alert(immediateSwitch.checked);
}
}
</
script
>
and got the same results. How do you get a reference to another Switch on the page??????
standardGrid.dataSource.sort({ field: "ProjectName", dir: "dsc" });
@(Html.Kendo()
.Grid<
CorporateSys.Data.GetProjectsByIdBusinessUnitIdsUserIdTagged_Result
>()
.Name("ProjectStandardGrid")
.HtmlAttributes(new { style = "display:inline-block; height:100%; clear:both;" })
.Columns(columns =>
{
columns.Bound(c => c.ProjectId).Hidden();
columns.Bound(c => c.ProjectName);
columns.Bound(c => c.ProjectType);
})
.Filterable()
.Groupable()
.Sortable()
.DataSource(ds => ds.Ajax()
.Read("GetJobs", "Job", new { isBau = Model.IsBau, clientId = Model.ClientId })
.ServerOperation(true)
.PageSize(20))
.Events(events=>events.DataBound("OnStandardGridDataBound"))
.Pageable()
)
function OnStandardGridDataBound(e) {
var grid = $("#ProjectStandardGrid").data("kendoGrid");
var th = grid.thead.find(".k-link");
th.find('span').remove();
var sortSettings = grid.dataSource._sort;
if (sortSettings != "" && sortSettings != null) {
for (var i = 0; i <
sortSettings.length
; i++) {
var
sort
=
sortSettings
[i];
var
thSort
=
grid
.thead.find("th[
data-field
=
'" + sort.field + "'
] .k-link");
if (sort.dir == "dsc") {
//thSort.append("<span
class
=
'k-icon k-i-arrow-n'
></
span
>"); //k-i-arrow-s
thSort.append("<
span
class
=
'k-icon'
></
span
>"); //k-i-arrow-s
} else if (sort.dir == "asc") {
thSort.append("<
span
class
=
'k-icon'
></
span
>"); //k-i-arrow-s
}
}
}
Hi,
I would like users to direct to new pages/controllers when they click on different pieces of pie chart.
I found something similar https://www.telerik.com/forums/pie-chart-with-link but its related to RadCharts and not Kendo.
Can you please provide a code snippet or link to docs.
I tried using parameter like url but that didnt work.
@(Html.Kendo().Chart()
.Name("chart")
.Title("Big Players")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.Series(series =>
{
series.Pie(new dynamic[] {
new {category = "Apple",value = 40.3, color = "#ff3d00", url = "https://www.apple.com"},
new {category = "Microsoft",value = 0.4, color = "#f3e5f5", url = "https://www.microsoft.com"},
new {category = "IBM",value = 40.6, color = "#304ffe", url = "https://www.ibm.com"}
})
.Labels(labels => labels
.Visible(true)
.Template("#= category # - #= kendo.format('{0:P}', percentage)#")
);
}))
Thank you
Hi folks,
I'm running the Grid SignalR example (found here http://demos.telerik.com/aspnet-mvc/grid/signalr) locally.
Even though it is running locally, the sample still fetches data from the Web, instead of my local machine as in:
var hubUrl = "http://demos.telerik.com/kendo-ui/service/signalr/hubs";
I want to run this entirely locally. I'm getting data from the local backend data service by running the code found here on my machine:
https://github.com/telerik/kendo-ui-demos-service
However, I'm stuck at what route on my local system replaces http://demos.telerik.com/kendo-ui/service/signalr/hubs
Would the local route be
var hubUrl = http://localhost:42471/hubs;
How do I set the route?
Thanks,
Ken