kendo-grid

Using Kendo Grid in PartialView

最后都变了- 提交于 2019-12-04 21:05:47
I have two <section> in the Index view of my MVC application and I want to render two partial views in these sections. There is no problem rendering a Kendo grid to one Index. However, in order to render data on Kendo Grid, could I use the two methods returning Json in the controller as shown below. Could you give me an example how to achieve this? Controller: public ActionResult Index() { return View(); } public ActionResult Issues_Read([DataSourceRequest]DataSourceRequest request) { IQueryable<Issue> issues = db.Issues; DataSourceResult result = issues.ToDataSourceResult(request, c => new

How to compare and display kendo dirty flag upon editing only if the old value and new value are different before saving the grid

一个人想着一个人 提交于 2019-12-04 21:02:13
In a kendo grid, in grid cell when I change a value kendo's dirty flag is displayed. But then when I click back to the same grid cell and change it to the previous value (already existing value) the dirty flag still appears. How can I check whether the value is similar to the previous value and not display the dirty flag before saving. Below is my code for kendo editable dropdown. function editCategoryDropDown(container, options) { var catObject = JSON.parse(ticketProjectCategoryObject.value); $('<div id="categoryDDTreeView" class="dropDownTreeViewStyle"/>').appendTo(container); var

How to filter a Kendo UI MVC grid using a dropdown list

久未见 提交于 2019-12-04 19:05:50
I have a kendo grid that is filtered by pushing values from a dropdownlist into the built in kendo filters. I can search the grid using the same method when I type values in a textbox and search. This is my kendo grid and the dropdown @(Html.Kendo().DropDownListFor(model => model.MyObject.ID) .Name("Objects").DataTextField("Value").DataValueField("Key") .BindTo(@Model.MyObjectList).AutoBind(true) .HtmlAttributes(new { id = "selectedObject" }) <a class="button" onclick="searchGrid()" id="search">Search</a> @(Html.Kendo().Grid<MyViewModel>() .Name("MyGrid").HtmlAttributes(new { style = "

Conditional in Kendo grid column template

三世轮回 提交于 2019-12-04 17:13:39
问题 I need to apply a condition in my kendo grid column template. Here is my code: columns: [ { field: "EmpName", title: "Name", template: '<a href="\\#" onclick="showName();">#= if (empName == null){ "show xxx" } else { // I want to show actual name if it is not null empName } #</a>' }, 回答1: Check this '<a href="" onclick="showName();">'# if( empName==null) {#<span>show xxx<span># } else {#<span>#: empName#<span>#} #'</a>' 回答2: something like this should work for you: # if(test == null) { #

How to refresh the Kendo UI grid

耗尽温柔 提交于 2019-12-04 16:32:51
问题 I am trying to refresh a Kendo UI grid but have not yet been successful. Would anybody please advise what I missed or what I did wrong? I have the following code: .cshtml: $('#btnRefresh').click(function (e){ $.ajax({ type: 'POST', url: "@(Url.Content("~/Administration/RefreshAll/"))", success: function () { $("#Product").data("kendoGrid").dataSource.read(); $('#Product').data('kendoGrid').refresh(); //grid.refresh(); location.reload(true); }, error: function (){ $("#btnRefresh").removeAttr(

Kendo Grid Export To Excel Currency formatting

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 14:56:24
I am trying to export my Kendo grid to excel. It works fine except the formatting is missing. I think it is because I am using a template. The Telerik documentation explicitly states: To format the cell values during the export of the Grid to Excel, set the format option of the cells. I have tried this and it is not working: columns: [ { field: "EntryWage", headerTemplate: entryLevelWageColumnHeading + "<span name='EntryWage' class='k-icon k-i-close remove' style='float: right;'></span>", width: 125, attributes: { style: "text-align:right;" }, format: "{0:c}", template: "#= (EntryWage != null)

Kendo UI Grid Refesh on Dropdown Selection

a 夏天 提交于 2019-12-04 13:16:32
I have a grid where each row has a select drop down box in with values. When an item is selected, how can I make the grid reload to reflect the change? The reason I want to do this is because the item selected from the drop down effects an amount in another column. Here is the code for my dropdown: function shippingModelSelect(container, options) { $('<input required data-text-field="modelName" data-value-field="modelId" data-bind="value:' + options.field + '"/>') .appendTo(container) .kendoDropDownList({ autoBind: false, dataSource: [ { "modelName": "Individual shipping cost", "modelId": 1 },

ASPNet.Core 1.0 RTM Kendo Grid not displaying data

喜夏-厌秋 提交于 2019-12-04 11:35:05
It looks like the new internal build (2016.2.630) for ASPNet Kendo MVC does not work with the Kendo Grid. Or at least not with returning Json from a Read action in the grid. @(Html.Kendo().Grid<EmployeeModel>() .Name("grid") .Columns(columns => { columns.Bound(p => p.EmployeeID).Visible(false); columns.Bound(p => p.Name); columns.Bound(p => p.Salary); }) .Pageable() .HtmlAttributes(new { style = "height:550px;" }) .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Read(read => read.Action("Employees_Read", "Home")) ) .Deferred() ) This is the Read Action in the controller: public

Send Additional Parameter in Kendo Grid Read Action

妖精的绣舞 提交于 2019-12-04 10:08:34
问题 I have a kendo Grid as follows. @(Html.Kendo().Grid<RevenueModel>() .Name("WeeklyRevenue") .Resizable(resizing => resizing.Columns(true)) .Columns(columns => { columns.Bound(p => p.Number).Width(100); columns.Bound(p => p.Type).Width(100); columns.Bound(p => p.Week1).Format("{0:c}"); columns.Bound(p => p.Week2).Format("{0:c}"); columns.Bound(p => p.Week3).Format("{0:c}"); columns.Bound(p => p.Week4).Format("{0:c}"); columns.Bound(p => p.Week5).Format("{0:c}"); columns.Bound(p => p

Kendo Grid Edit InLine Custom Validation message e.g. for duplicate Names etc

你说的曾经没有我的故事 提交于 2019-12-04 08:16:28
问题 I have an entity Location and I am using the Kendu UI Grid with InLine edit mode. The entity owns a property DisplayName , which is required and must not exist twice in the database. At the moment, it works to display the Required Validation message: And it also works to build up a method CustomValidateModel called in the LocationController Ajax InLine Create method, that checks if the Name is already existing in the database and adds then a ModelError . I catch this error then in the .Events