{ command: { text: "Unwind", click: showUnwind }, title: " ", width: "50px" },
function showUnwind(e) { e.preventDefault(); var dataItem = this.dataItem($(e.currentTarget).closest("tr")); var selImagineSNum = dataItem["ImagineSNum"]; var direction = _rootUrl + "CFD/GetUnwindWindowContent/" + selImagineSNum; var wnd = $("#unwindWindow").data("kendoWindow"); if (!wnd) { // first click of the button - will automatically fetch the contentUrl wnd = $("#unwindWindow").kendoWindow({ title: "Unwind Trade", actions: ["Minimize", "Maximize", "Close"], content: direction, width: "800px", height: "600px", visible: false, modal: true }).data("kendoWindow"); } wnd.refresh(direction); wnd.center(); wnd.open(); }
4. The CFDUnwind.init() method is in CFD.Unwind.js and that file is of course already loaded. The code is:@{ Layout = null; } <div style="margin: 5px 5px 0 5px;"> @* Header *@ <table class="table table-condensed"> <tr><th>PrcmNum</th><th>ImagineSNum</th><th>PrimeBroker</th><th>Fund</th><th>Trade Date</th><th>Setl. Date</th></tr> <tr><td>@ViewBag.Id</td><td>@ViewBag.Id</td><td>PrimeBroker</td><td>Fund</td><td>01/01/2012</td><td>01/02/2012</td></tr> </table> @* Grid *@ <p class="help-block">Associated trades based on: Fund, Prime Broker & PrcmNum</p> <div id="gridAssoc"></div> </div> <script type="text/javascript"> CFDUnwind.init(); /* $(function () { CFDUnwind.init(); }); */ </script>
var CFDUnwind = {}; CFDUnwind._assocTradesDataSource = null; // *** Initialize the CFD partial view CFDUnwind.init = function () { // ** DataSource for the CFD Trades CFDUnwind._assocTradesDataSource = new kendo.data.DataSource({ transport: { read: { type: "POST", url: _rootUrl + "CFD/GetAssocCFDTradesPOST", dataType: "json" } }, schema: { model: { id: "ImagineSNum", fields: { Confirmed: { editable: true, type: "boolean" }, PrcmNum: { editable: false, type: "number" }, ImagineSNum: { editable: false, type: "number" }, Fund: { editable: false, type: "string" }, Strategy: { editable: false, type: "string" }, Folder: { editable: false, type: "string" }, Name: { editable: false, type: "string" } } } } }); // ** Grid widget $("#gridAssoc").kendoGrid({ dataSource: CFDUnwind._assocTradesDataSource, navigatable: true, selectable: "single", height: 280, resizable: true, sortable: { mode: "single", allowUnsort: false }, columns: [ { field: "Confirmed", title: "✓", width: 15, template: '<input type="checkbox" #= Confirmed ? checked="checked" : "" # ></input>' }, { field: "PrcmNum", title: "PrcmNum", width: 45 }, { field: "ImagineSNum", title: "ImagineSNum", width: 45 }, { field: "Fund", title: "Fund", width: 55 }, { field: "Strategy", title: "Strategy", width: 55 }, { field: "Folder", title: "Folder", width: 55 }, { field: "Name", title: "Instr. Name", width: 60 } ], dataBound: function (e) { // console.log("gridAssoc dataBound event"); } }); }
$(document).ready(
function
() {
$(
"#grid"
).kendoGrid({
dataSource: {
type:
'odata'
,
transport: {
read: {
url:
"http://localhost:13059/api/Addressbook"
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
type:
"GET"
,
data: {}
},
parameterMap:
function
(options, type) {
var
paramMap = kendo.data.transports.odata.parameterMap(options);
delete
paramMap.$inlinecount;
// <-- remove inlinecount parameter.
delete
paramMap.$format;
// <-- remove format parameter.
//paramMap.$includeTotalCount= "True";
return
paramMap;
}
},
success:
function
(e) {
alert(
"Success: "
+ e.error);
},
error:
function
(e) {
debugger;
alert(
"Error: "
+ e.errorThrown);
},
change:
function
(e) {
// alert("Change");
},
requestStart:
function
(e) {
//alert("Request Start");
},
schema: {
data:
function
(data) {
return
data.Results;
// <-- The result is just the data, it doesn't need to be unpacked.
},
total:
function
(data) {
// return data.length; // <-- The total items count is the data length, there is no .Count to unpack.
return
data.TotalResults;
},
model: {
fields: {
Country_Code: { type:
"string"
},
Country_ID: { type:
"number"
},
Country_Name: { type:
"string"
},
County_Desc: { type:
"string"
}
}
}
},
pageSize: 1,
//serverPaging: true,
// serverFiltering: true,
// serverSorting: true
},
height: 250,
filterable:
true
,
sortable:
true
,
pageable:
true
});
});
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();
});