Running into a weird issue, we're setting up our grids with javascript for this page.
$('#assets-grid').kendoGrid({
dataSource: new kendo.data.DataSource({
transport: {
read: 'application/GetAssetDetails'
},
schema: {
data: function(response) {
var result = [];
if (!response.success && response.message) {
errorAlert(response.message, 'modalNoteLabel', 10000);
}
if (response && response.Data) {
result = response.Data;
}
return result;
},
total: function(response) {
var length = 0;
if (response && response.Data) {
length = response.Data.length;
}
return length;
}
},
pageSize: 10,
serverPaging: false //I added this to fix, also tried serverOperation:false and that didnt work
}),
autoBind: false,
sortable: true,
scrollable: false,
pageable: true,
columns: [
{
field: 'Column',
title: 'olumne',
attributes: {
'title': '#: Column #'
},
headerAttributes: {
'title': 'column'
}
},
{
field: 'Column',
title: 'Column',
attributes: {
'title': '#: Column #'
},
headerAttributes: {
'title': 'Column'
}
},
{
field: 'Column',
title: 'Column',
attributes: {
'title': '#: Column #'
},
headerAttributes: {
'title': 'Column'
}
},
{
field: 'Column',
title: 'Column',
attributes: {
'title': '#: Column #'
},
headerAttributes: {
'title': 'Column'
}
}
],
noRecords: {
template: "No records are found."
}
});
Ive added the section in the Datasource for serverPaging: False.
What was happening is when the user loads the gird it would load fine, when they navigated the pages its fine, however if you looked at the network tab in developer tool bar or monitored events on the server you would notice 503 for the request stating that the id coming back is null. I tried to use serverOperation:false but that was still showing the same issue. I switched it to serverPaging and it seems to be resolved. My question is, Is this correct? Is there something else I am missing that should be done to prevent 503's when navigating paging?
Hi,
I'm currently creating Charts dynamically with a mixture of Columns and Lines.
I have two lines in this particular chart 1. Cumulative Total (CT) and 2. Forecast Cumulative Total (FCT).
What I'm trying to achieve is, for this financial year we calculate our "CT" up to the current month/year and anything after that we calculate our "FCT".
How do i get these lines to match as the end of the period of the "CT" and start of "FCT".
I have attached an example that i can easy do in Excel.
Thanks,
Lee.
I have tried to find som help on why i can't use this binding feature to my excel export part of the mvc grid compoment.
var grid = $("#grid").data("kendoGrid");
grid.bind("excelExport", function (e) {
e.workbook.fileName = "Grid.xlsx";
});
grid.saveAsExcel();
This i my first beginning of these binding options, and the goal is to use them to hide/show during export.
To get to this goal, is need the first part solved first- my binding fails in the bold line in script performance on website.
The error is:Uncaught TypeError: Cannot read property 'bind' of undefined
Whay cant i use this bind to capure the excelExport event ??
regards
Allan
.Read( read => read.Action( "BindImages", "CatalogAdministration" ).Data( "bind_images" ) )
function
bind_images() {
var
grid = $(
"#GridInventoryItems"
).data(
"kendoGrid"
);
grid.select().each(
function
() {
var
dataItem = grid.dataItem($(
this
));
key = dataItem.InventoryItemId;
});
return
{
inventoryItemId: key
};
}
public
JsonResult BindImages(
int
? InventoryItemId )
{
JsonResult result =
null
;
if
( InventoryItemId.HasValue )
{
result = Json( _GetImageViewModelRecords( InventoryItemId ) );
}
return
result;
}
I've been trying to add a dropdown list to a grid cell for a while now and I can get the dropdown to appear but whenever it changes it doesn't seem to actually save the value. When I choose a item the save event does end up firing but tabbing off of the field nothing has changed and the put doesn't get hit. the other fields with just regular text boxes seem to work just fine.
Grid Code:
@(Html.Kendo().Grid<FieldTimeEntry.Web.Repos.Testing.DtsCrewDetLabor>()
.Name("dtsLaborGrid")
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Columns(columns =>
{
columns.Command(command => command.Destroy()).Width(100);
columns.Bound(p => p.EmpName);
columns.Bound(p => p.EmpNo);
columns.Bound(p => p.EmpBillCode);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Navigatable()
.Sortable()
.Scrollable()
.Events(e =>
{
e.Save("onSave");
e.DataBound("onDataBound");
})
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(20)
.ServerOperation(false)
.AutoSync(true)
.Model(m =>
{
m.Field(f => f.GfEmpNo).DefaultValue(Model.GfEmpNo);
m.Field(f => f.CrewCode).DefaultValue(Model.CrewCode);
m.Id(p => p.SeqNo);
m.Field(f => f.EmpNo);
})
.Create(create =>
{
create.Action("Create", "CrewsApi");
create.Type(HttpVerbs.Post);
})
.Read(read =>
{
read.Action("Get", "CrewsAPI", new { id = Model.CrewCode });
read.Type(HttpVerbs.Get);
})
.Update(update =>
{
update.Action("Put", "CrewsAPI");
update.Type(HttpVerbs.Put);
})
.Destroy(destroy =>
{
destroy.Action("Delete", "CrewsAPI");
destroy.Type(HttpVerbs.Delete);
})
))
Editor Template:
@(Html.Kendo().DropDownList()
.Name("EmployeeId")
.DataTextField("NameAlpha")
.DataValueField("EmployeeId")
.DataTextField("NameAlpha")
.DataValueField("EmployeeId")
.Filter("contains")
.OptionLabel("Select Employee")
.AutoWidth(true)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetEmployeesFiltered", "ReferenceData");
})
.ServerFiltering(true);
})
.Animation(a =>
{
a.Open(e =>
{
e.Fade(FadeDirection.In);
});
}))
JS Events:
var lastEditIndex;
function onSave(e) {
lastEditIndex.row = this.tbody.children().index(e.container.parent());
lastEditIndex.col = e.container.parent().children().index(e.container);
}
function onDataBound(e) {
var grid = this;
if (!$.isEmptyObject(lastEditIndex)) {
var cell = grid.tbody.children().eq(lastEditIndex.row).children().eq(lastEditIndex.col);
grid.current(cell);
grid.table.focus();
}
lastEditIndex = {};
}
Hello,
We used treelist which inside scrollable div in our MVC project. If we configured scrollable= false for treelist all column's width will mess up. If we used default setting (which is scrollable=true) the double scroll bar appeared which is not allowed in project. How to configured scroll bar only horizontally or vertically for Kendo UI treelist ?
Thanks
Hi ,
Hope you can help . I have a grid that is using SP via Enity Framework . If I do not using paging it pulls back all the records . However when I enable Paging it shows the correct number of pages but will only show the first 10 records ( or how many I set in PageSize() ) if I click on page 2, 3, , etc I see the same records .
This is my grid
@model IEnumerable<SchoolsDisruptionPortal.Models.spSchoolsUserID_Result>
@{
ViewBag.Title =
"ListSchoolsUserID"
;
}
<h2>@Resource.SchoolUser</h2>
@(Html.Kendo().Grid(Model).Name(
"SchoolsUserID"
).Columns(c =>
{
c.Bound(p => p.FriendlyName).Title(Resource.SchoolName).Width(450);
c.Bound(p => p.Full_Name).Title(Resource.FullName).Width(300);
c.Bound(p => p.Username).Title(Resource.UserName).Width(200);
})
.Pageable()
.ToolBar(tools => tools.Excel().Text(Resource.Export)).Excel(excel => excel.FileName(@Resource.SchoolUser +
".xlsx"
).AllPages(
true
))
.DataSource ( d => d
.Ajax()
.PageSize(30)
)
)
I know it`s going to be something simple . It`s not a major requierment to my project but would make it look cleaner .
I'm currently evaluating the Grid control, and managed to build my grid using c# using the html helper.
My dataset has too many columns to put into one row and I trying to building a child grid using a client template to pass it the additional columns required.
My c# function contain the bones of the child grid based upon an ExpandoObject, along with a local json array that I would like to insert into the datasource, can you tell me how I am able to achieve this?
var jsonColumns = Newtonsoft.Json.JsonConvert.SerializeObject ( row );
var grid = html.Kendo ().Grid<System.Dynamic.ExpandoObject> ()
.Name ( "test" )
.ToClientTemplate();