//define the dataSource for the gridsearchVM.dataSource = new kendo.data.DataSource({ schema: { model: { fields: { Number: { type: "string" }, DateReceived: { type: "date" }, County: { type: "string" }, Media: { type: "string" } } } }, pageSize: 10, change: function (e) { //refresh the grid var grid = $("#searchResults").data("kendoGrid"); grid.refresh(); }});Hi
i am using KendoUi Grid to display the data on my page from a datasource .
Here is the Code for the same .
@using Kendo.Mvc.UI @model IEnumerable<Ami.WebRole.Models.FacilityGroupModel> @{ ViewBag.Title = "Manage Facility Group "; } <script type="text/javascript"> $(document).ready(function () { $("form.k-edit-form").kendoValidator(); }); </script> <style type="text/css"> .k-widget.k-window { width: 450px; height: 250px; } </style> <h2 style="color:Maroon;">Manage Facility Group</h2> <hr /> <table> <td> <td align="center"> <table> <tr> <td align="left"> @using (Html.BeginForm("ManageFacilityGroup", "ManageFacilityGroup", FormMethod.Get)) { <fieldset> <table> <tr> <td> <p> <span><b> Name:</b></span> </p> </td> <td> <p> @(Html.Kendo().AutoComplete() .Name("FacilityGroupName") .DataTextField("FacilityGroupName") .Filter("Contains") .IgnoreCase(true) .DataSource(source =>{ source.Read(read => { read.Action("GetFacilityName", "ManageFacilityGroup") .Data("onAdditionalData"); }) .ServerFiltering(true); }) ) <script type="text/javascript"> function onAdditionalData() { return { text: $("#FacilityGroupName").val() }; } </script> </p> </td> <td align="left"> <span><b>Status:</b></span> </td> <td> @(Html.Kendo().DropDownList() .Name("chkStatus") .DataTextField("Text") .DataValueField("Value") .BindTo(new List<SelectListItem>() { new SelectListItem() { Text = "All", Value = "-1" }, new SelectListItem() { Text = "Active", Value = "true" }, new SelectListItem() { Text = "InActive", Value = "false" } }) .Value("1") ) </td> <td align="right"> <p> <input id="Submit1" type="submit" value="Search" /> </p> </td> </tr> </table> </fieldset> } </td> </tr> <tr> <td align="center" > @(Html.Kendo().Grid(Model) .Name("Grid") .Columns(columns => { columns.Bound(p => p.CustomerName).HtmlAttributes(new { style = "text-align:left;" }).Width(150); columns.Bound(p => p.FacilityGroupName).HtmlAttributes(new { style = "text-align: left;" }).Width(170).Title("Facility Group Name"); columns.Bound(p => p.StatusName).HtmlAttributes(new { style = "text-align: center;" }).Width(90).Title("Status"); columns.Bound(p => p.CreationDate).HtmlAttributes(new { style = "text-align: right;" }).Width(110).Format("{0:MM/dd/yyyy}"); columns.Command(command => { command.Edit(); }).Width(85); }) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("FacilityGroupPopUp").Window(window => window.Title("Edit Facility Group").Name("editwindow1"))) .Scrollable() .Pageable(p => p.PageSizes(true)) .Sortable() .DataSource(datasource => datasource .Ajax() .ServerOperation(false) .Model(model => model.Id(p => p.FacilityGroupId)) .Read(read => read.Action("ManageFacilityGroup", "ManageFacilityGroup")) .Update(update => update.Action("Update", "ManageFacilityGroup")) ) ) </td> </tr> </table> </td> </td> </table>@model Ami.WebRole.Models.FacilityGroupModel @using Kendo.Mvc.UI <fieldset> @* <legend>Edit Facility Group</legend>*@ <table border="10" cellpadding="0" cellspacing="0" style="border-color:Black; width:350px;" > <tr> <td colspan="2"> @if (ViewData["FailureMessage"] != null) { <div id="divFailureMsg" style="height:25px; background-color:#fffeff;visibility:visible ;color:Red" align="center"> @Html.Label(ViewData["FailureMessage"].ToString()) </div> } else { <div id="divFailureMsg" style="visibility:hidden; height:0px;"> </div> } </td> </tr> <tr> <td style="width:150px;"> @Html.LabelFor(model => model.CustomerName) </td> <td> @(Html.Kendo().DropDownList() .Name("CustomerName") .DataTextField("CustomerName") .DataValueField("CustomerName") //.DataValueField("CustomerId") .DataSource(source => { source.Read(read => { read.Action("GetCustomer", "ManageFacilityGroup"); }); }) ) </td> </tr> <tr> <td> @Html.LabelFor(model => model.FacilityGroupName) </td> <td> @Html.TextBoxFor(model => model.FacilityGroupName, new { style = "width:156px;" }) </td> </tr> <tr> <td> @Html.LabelFor(model => model.Description) </td> <td> @Html.TextAreaFor(model => model.Description, new { style = "width:163px;" }) </td> </tr> <tr> <td> @Html.LabelFor(model => model.status) </td> <td> @(Html.Kendo().DropDownList() .Name("StatusName") .DataTextField("StatusName") .DataValueField("StatusName") .DataSource(source => { source.Read(read => { read.Action("GetStatus", "ManageFacilityGroup"); }); }) ) </td> </tr> </table> </fieldset> $("#txtActions").kendoEditor({ tools: [ "bold", "italic", "underline", "insertUnorderedList", "insertOrderedList", ], paste: function (e) { var editor = $("#txtActions").data("kendoEditor"); editor.value(CleanWordHTML(e.html)); //console.log(editor); }});var threshold = 100;var throughputPer10min = [ 15, 26, 21, 40, 63, 16, 38, 79, 120, 54, 12, 56, 75, 102, 110, 130, 90, 75, 50, 5];var startDate = new Date();var chartData = [];for (i = 0; i < throughputPer10min.length; i++) { var date = new Date(startDate); date.setMinutes(startDate.getMinutes() + (10 * i)); chartData.push({ "time": date, "threshold": threshold, "actual": throughputPer10min[i], "below": Math.min(throughputPer10min[i], threshold), "above": Math.max(0, throughputPer10min[i] - threshold) });}var endDate = chartData[chartData.length - 1].time;chartData[chartData.length - 1].threshold = threshold;$("#testGraph").kendoChart({ dataSource: { data: chartData }, valueAxis: { majorUnit: 50, min: 0, max: 150 }, categoryAxis: { field: "time", baseUnit: "minutes", type: "Date", majorGridLines: { visible: false }, majorTicks: { visible: false }, labels: { step: 20 } }, series: [ { type: "area", stack: true, missingValues: "interpolate", field: "below", color: "#55F", line: { color: "blue" }, }, { type: "area", stack: true, missingValues: "interpolate", field: "above", color: "green" }, { type: "line", field: "actual", missingValues: "interpolate", width: 1, markers: { size: 0 }, name: "Actual Throughput" }, { type: "line", field: "threshold", missingValues: "interpolate", name: "threshold", color: "red", dashType: "dash", width: 1.5, markers: { size:0 }, name: "Threshold line" } ], legend: { visible: false }});date.setMinutes(startDate.getMinutes() + (10 * i)); with getMinutes() + i, everything looks fine, otherwise, it looks as if I had used missingValues: "zero"When i am trying to update the value through the join it updated the database but not updating the gridview.
But after refreshing the page it is showing the updated value.
Here is my code.
@(Html.Kendo().Grid(Model)
.Name(
"Grid")
.Columns(columns =>
{
columns.Bound(p => p.RoleTypeName).HtmlAttributes(
new { style = "text-align: left" }).Width(90);
columns.Bound(p => p.Name).HtmlAttributes(
new { style = "text-align: left" }).Width(100);
columns.Bound(p => p.Status).HtmlAttributes(
new { style = "text-align: center" }).Width(80);
columns.Command(command => { command.Edit(); }).HtmlAttributes(
new { style = "text-align: center" }).Width(100);
})
.Editable(editable => editable.Mode(
GridEditMode.PopUp).TemplateName("PopUpTemplate").Window(w => w.Title("Manage Role").Name("editWindow").Width(400).Height(200)))
.Pageable(p => p.PageSizes(
true))
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
//.Server()
.Ajax()
.ServerOperation(
false)
.Model(model => model.Id(p => p.RoleID))
.Read(read => read.Action(
"ManageRole", "ManageRole"))
.Update(update => update.Action(
"Update", "ManageRole"))
)
)
@(Html.Kendo().DropDownListFor(model => model.StatusName)
.Name(
"StatusName")
.DataTextField(
"StatusName")
.DataValueField(
"StatusName")
.DataSource(source =>
{
source.Read(read =>
{
read.Action(
"GetStatus", "ManageRole");
});
})
)
When i update the status from the dropdownlist updates in data but not show in grid, it appear when refreshing the page.How can i remove this problem please help me out.