Hi,
I have a telerik grid which contains a template column.
What I would like to do is only apply sorting to this template column and NO other column in the grid.
Please can someone advise me on how I can go about doing this for the Name column?
Any help would be much appreciated as I am new to using Telerik grids.
Thank you very much
@(Html.Telerik().Grid(Model.MyGrid)
.Name("MyGrid")
.Columns(columns =>
{
columns.Template(c => @Html.ActionLink(c.Name, "Action", "Controller", new { id = c.Id }, null)).Width(100).Title("Name");
columns.Bound(c => c.Title).Width(100);
columns.Bound(c => c.Occupation).Width(100);
})
.Sortable(sorting => sorting.Enabled(true)))
HI,
we are showing a Popup from Kendo Ui Grid, The page is a Searc Page which has Dropdownlist and by selecting the value,
a kendo ui grid will be shown with data and by clicking the Edit button a popup is displayed. By using Ajax editing in grid, the popup is shown in center of the browser. but page refresh is not happening and dropdownlist is not populated.
@(Html.Kendo().Grid(Model)
.Name(
"Grid")
.Columns(columns =>
{
columns.Bound(p => p.RoleType).Width(80);
columns.Bound(p => p.Name).Width(100);
columns.Bound(p => p.Status).Width(70);
columns.Command(command => { command.Edit(); }).Width(100);
})
.Editable(editable => editable.Mode(
GridEditMode.PopUp).TemplateName("ManageRolePop").Window(w => w.Title("Manage Role").Name("editWindow")))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(
false)
.Model(model => model.Id(p => p.RoleID))
.Read(
"ManageRole", "ManageRole")
.Update(
"Update", "ManageRole")
)
By using Server editing the Popup orientation is at the bottom of the page and thewe are not able to set in center of the browser. Request you to help us in this issue.
@(Html.Kendo().Grid(Model)
.Name(
"Grid")
.Columns(columns =>
{
columns.Bound(p => p.RoleType).Width(80);
columns.Bound(p => p.Name).Width(100);
columns.Bound(p => p.Status).Width(70);
columns.Command(command => { command.Edit(); }).Width(100);
})
.Editable(editable => editable.Mode(
GridEditMode.PopUp).TemplateName("ManageRolePop").Window(w => w.Title("Manage Role").Name("editWindow")))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Server()
.ServerOperation(
false)
.Model(model => model.Id(p => p.RoleID))
.Read(
"ManageRole", "ManageRole")
.Update(
"Update", "ManageRole")
)
Request you to help us in this
@using Kendo.Mvc.UI@using KendoGrid.Models@(Html.Kendo().Grid<Person>() .Name("Grid") .Columns(columns => { columns.Bound(p => p.FirstName).Width(140); columns.Bound(p => p.LastName).Width(140); columns.Bound(p => p.DayOfBirth).Width(200); columns.Bound(p => p.Age).Width(150); columns.Command(command => command.Destroy()).Width(110); }) .ToolBar(toolbar => { toolbar.Create(); toolbar.Save(); }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .Pageable() .Sortable() .Scrollable() .DataSource(dataSource => dataSource .Ajax() .Batch(true) .ServerOperation(false) .Events(events => events.Error("error_handler")) .Model(model => model.Id(p => p.Id)) .Read("Read", "Grid") .Create("Create", "Grid") .Update("Update", "Grid") .Destroy("Destroy", "Grid") ) ) <div style="margin-top: 20px"> @(Html.Kendo().DatePicker() .Name("datepicker") .Value("10/10/2011") .HtmlAttributes(new { style = "width:150px" }) ) </div><script type="text/javascript"> function error_handler(e) { if (e.errors) { var message = "Errors:\n"; $.each(e.errors, function (key, value) { if ('errors' in value) { $.each(value.errors, function () { message += this + "\n"; }); } }); alert(message); } }</script><!DOCTYPE html><html><head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <link rel="stylesheet" href="@Url.Content("~/Content/kendo.common.min.css")"> <link rel="stylesheet" href="@Url.Content("~/Content/kendo.default.min.css")"> <link rel="stylesheet" href="@Url.Content("~/Content/examples-offline.min.css")"> <script src="@Url.Content("~/Scripts/jquery.min.js")"></script> <script src="@Url.Content("~/Scripts/kendo.web.min.js")"></script> <script src="@Url.Content("~/Scripts/kendo.aspnetmvc.min.js")"></script> <script src="@Url.Content("~/Scripts/console.min.js")"></script> <script src="@Url.Content("~/Scripts/prettify.min.js")"></script> @RenderSection("HeadContent", false)</head><body> <div class="page"> <div id="example" class="k-content"> @RenderBody() </div> </div></body></html>$('#scrollview-container [data-role="page"]').on('mousedown', function(e) { console.log('mousedown'); e.stopImmediatePropagation(); }); $('#scrollview-container [data-role="page"]').on('touchstart', function(e) { console.log('touchstart'); e.stopImmediatePropagation(); });<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Tutorial2_4.aspx.cs" Inherits="KnockoutApp.Tutorials.Tutorial2_3" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"><style type="text/css"> .deleteLink { color: red; font-weight: bold; }</style></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <!-- --> <div id="mvvmRegion"> <h2>Your seat reservations (<span data-bind="text: seats.length" ></span>)</h2> <button id="addSeatButton" data-bind="click: addSeat">Reserve another seat</button> <div style="width: 600px;"> <table id="reservationTable"> <thead><tr> <th data-field="name" style="width: 160px;">Passenger name</th> <th data-field="meal.mealName" style="width: 160px;">Meal</th> <th data-field="meal.price" style="width: 100px;">Surcharge</th> <th> </th> </tr></thead> <tbody> </tbody> </table> </div> <h3 data-bind="visible: surcharge"> Total surcharge: $<span data-bind="text: totalSurcharge00"></span> </h3> </div><script id="reservationTemplate" type="text/x-kendo-template"><tr> <td style="width: 160px;"><input id="nameTextBox" value="#= name #" data-bind="value: seats.name" /></td> <td style="width: 160px;"><input id="mealDropDown" class="mealDropDownClass" value="#= meal.mealName #" data-bind="value: seats.meal.mealName" /></td> <td style="width: 100px;">#= meal.price #</td> <td><a href="" class="deleteLink">Remove</a></td></tr></script> <script type="text/javascript"> // Class to represent a row in the seat reservations grid function SeatReservation(fname, initialMeal) { var self = this; self.name = fname; self.meal = initialMeal; } // var availableMeals = [ { mealName: "Standard (sandwich)", price: 0.0 }, { mealName: "Premium (lobster)", price: 34.95 }, { mealName: "Ultimate (whole zebra)", price: 290.0 } ]; // var viewModel = kendo.observable({ // type array populates the drop down meals: availableMeals, // array will hold the grid values seats: [ new SeatReservation("Steve", availableMeals[1]), new SeatReservation("Bert", availableMeals[0]) ], // Computed data totalSurcharge: function () { var total = 0; for (var i = 0; i < this.get("seats").length; i++) total += this.get("seats")[i].meal.price; return total + 0.00; }, totalSurcharge00: function () { var total = this.totalSurcharge() + 0.00; return total.toFixed(2); }, surcharge: function () { var total = this.totalSurcharge() + 0.00; if (total > 0) return true; return false; }, // maxSeating: function () { if (this.seats.length < 5) return true; return false; }, // seats.length < 5 // event execute on click of add button addSeat: function (e) { // add the items to the array of expenses this.get("seats").push(new SeatReservation("", self.availableMeals[1])); return false; }, removeSeat: function (seat) { var seats = this.get("seats"); seats.splice(seats.indexOf(seat), 1); } }); // apply the bindings kendo.bind($("#mvvmRegion"), viewModel); // var reservationDataSource = new kendo.data.DataSource({ data: viewModel.get("seats"), schema: { model: { id: "name", fields: { // data type of the field {Number|String|Boolean|Date} default is String name: { type: "String" }, meal: { mealName: { type: "String" }, price: { type: "Numeric" } } } } } }); // $("#reservationTable").kendoGrid({ dataSource: reservationDataSource, rowTemplate: kendo.template($("#reservationTemplate").html()), dataBound: function (e) { $(".deleteLink").click(function (e) { e.preventDefault(); if (confirm("Do you what to delete this?")) { var grid = $("#reservationTable").data("kendoGrid"); var dataItem = grid.dataItem($(this).closest("tr")); viewModel.removeSeat(dataItem); } return false; }); } }); $(".mealDropDownClass").kendoDropDownList({ dataTextField: "mealName", dataValueField: "mealName", dataSource: availableMeals }); // </script></asp:Content>[{"status":"Received","number":"2"},{"status":"In Progress","number":"1"}]function createChart() { $("#chart").kendoChart({ theme: $(document).data("kendoSkin") || "default", dataSource: { transport: { read: { dataType: "json" }, }, sort: { field: "status", dir: "asc" }, }, chartArea: { height: 125, width: 125 }, legend: { visible: false }, seriesDefaults: { type: "pie" }, series: [{ field: "number", categoryField: "status", padding: 10 }], tooltip: { visible: true, template: "#= dataItem.status #: #= dataItem.number #" } });}Thank you very much for your time.
puyo