kendo-grid

KendoUI: resetting grid data to first page after button click

我的梦境 提交于 2019-11-29 09:33:41
I have the following scenario: in my page I have a grid (with pagination) bounded to a datasource. When I click on the button "Extract" the grid gets populated (reading paginated data through a web service). Then i select "page 2" through grid pagination. Again the web service is invoked to return data. Now: I would like to click on "Extract" once more, to reload and show data on the first page. I'm not sure which is the best way. I would like to make just one call to the service (with input parameters) and have pagination index in the grid resetted. I am now using the following code: $("

Get record count in Kendo Grid after dataSource.read

泪湿孤枕 提交于 2019-11-29 09:13:21
I want to be able to push the record count from my Kendo grid after read (refresh). Here is my Kendo Grid: @(Html.Kendo().Grid(Model) .Name("SearchWindowGrid") .Columns(columns => { columns.Bound(p => p.SYSTEM_ITEMS_SEGMENT1).Hidden(); }) .ClientRowTemplate( "<tr>" + "<td>" + "<span><b>#: SYSTEM_ITEMS_SEGMENT1#</b></span> <br/>" + "<span>#: DESCRIPTION# </span>" + "</td>" + "</tr>" ) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("PopulateSearchWindow", "Item").Data("additionalSearchWindowInfo")) .Events(ev => ev.Error("onErrorSearchWindow")) ) .Selectable(s => s

How to call refresh() on a kendo-grid from an Angular controller?

…衆ロ難τιáo~ 提交于 2019-11-29 07:23:00
I'm attempting to follow several suggestions on refreshing a kendo-grid such as this . The essential is that in the html I have: <div kendo-grid="vm.webapiGrid" options="vm.mainGridOptions"> Then in the controller I have: vm.webapiGrid.refresh(); Note: I'm using the ControllerAs syntax so I am using "vm" rather than $scope. My problem is that "vm.webapiGrid" is undefined. This seems so straightforward, but I'm not sure why it is undefined. Found the answer. One other method of refreshing the datasource I read about was to do something like: vm.mainGridOptions.datasource.transport.read(); This

How to update Kendo Grid row from window

China☆狼群 提交于 2019-11-29 07:16:27
The set-up: ASP MVC project Kendo Grid in a view via Razor Column custom command, calls... JavaScript that opens Kendo window with refresh() URL to partial view as custom form The form has an input type=button calling JavaScript The barrier: How to update the row (dataItem?) of Grid with new model (from window/form javascript). I am unable to get a handle to target dataItem. Select() is not applicable here because the row is not selected. Instead, a custom button event opens modal Grid Window having the fields and commands for update, close, etc.. I could use the native Edit of Grid, but what

Kendo data grid - how to set column value from nested JSON object?

本小妞迷上赌 提交于 2019-11-29 07:03:39
I have JSON with structure like this: "id":1, "user_role":"ADMIN", "state":"ACTIVE", "address":{ "street":"test 59", "city":"City test", "post_number":"25050" }, How I should to pass values of address.street into column using setting in fields and model? Many thanks for any advice. If you want to show all values in a single column do what @RobinGiltner suggests. If you want to show each member of address in a different column you can do: var grid = $("#grid").kendoGrid({ dataSource: data, editable: true, columns : [ { field: "id", title: "#" }, { field: "user_role", title: "Role" }, { field:

Set default filter for Kendo UI Grid

别来无恙 提交于 2019-11-29 06:44:30
I have a Kendo UI grid that is rendered with javaScript. I want the string columns to have a single option ("Contains") and without the second filter. So far so good, I wrote $("#MyGrid").kendoGrid({ // other bits of configuration here filterable: { extra:false, operators: { string:{ contains: "Contains"} } }, // more bits of configuration here }); As part of the definition of the grid. And the result looks good-ish (I only have one option, so the drop down is redundant). However, regardless of this, the filter still performs the equals operation rather than the contains operation (which is

Kendo: Handling Errors in Ajax Data Requests

萝らか妹 提交于 2019-11-29 02:51:32
Using Kendo UI in MVC4 I have a Grid that makes Ajax calls for data back into the Controller: public ActionResult SearchUser_Read([DataSourceRequest]DataSourceRequest request) { var data = CreateAnExcaptionHere(); return Json(data.ToDataSourceResult(request)); } How do I use this call to inform the page that there was an error? If you need to display an error message from the server then you can do it by returning a DataSourceResult object with only its Errors property set: return this.Json(new DataSourceResult { Errors = "my custom error" }); And pick it up on the client by using this

Kendo ui grid if else condition

天涯浪子 提交于 2019-11-29 02:23:15
What is wrong with my code? I have to check in kendo UI grid is there "OrderType 20" in my column. If it is, I need to apply my css condition which includes background, but it does not work, can someone help me? thanks template: '# if (OrderType == "OrderType 20") {#<div class='customClass'>#:OrderType#</div>#} else {#OrderType#}#' It might help you for nested if else for kendo ui grid row template. i.e. template: "#if(ErrorDesc==null){# #: DeviceLabel # #}else If(ErrorDesc==""){# #: DeviceLabel # #}else{# #: DeviceText # #}#" done on easier way: thank You all template: "#if(OrderType ==

How to add row number to kendo ui grid?

天涯浪子 提交于 2019-11-28 23:37:19
I have a kendo ui grid in my page that has some columns. Now I want to add a column to it that shows me row number. How to I do this? Thanks. Initialize a variable and show it in column as template: "#= ++record #" Working Demo Here is code: var record = 0; $("#grid").kendoGrid({ dataSource: { data: [{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo" },{ foo: "foo"

Kendo-UI grid Set Value in grid with Javascript

杀马特。学长 韩版系。学妹 提交于 2019-11-28 23:08:58
I'm just wondering how you go about changing a value of a row in a grid in JavaScript so that it is marked as 'dirty' in the grid and the underlying datasource. e.g. I have a list of Contact/Customer. They have 3 fields FirstName/LastName/IsPrimaryContact. There can only be 1 primary contact, so when the primary contact is set to true on a record I have JavaScript code that loops through the datasource and sets any other contacts set as primary to false. The JavaScript all fires fine and the data fields are set correctly but there are two problems: 1. The grid is not updated with the changes I