I am using a Kendo Editor for MVC and I would like to add either a custom button or image button in the Editor's Tools.
For example, I would like to add this line so the image can appear in the Tools:
<img id="btnCopy" name="btnCopy" src="~/Images/Copy.png" onclick='doSomething(document.getElementById("myText").value)' />
Is it possible to customize the Editor's Tools? if yes, what do I need to do? An example would be helpful.
Hello I was wondering if there is a similar kendo mvc function to the RadTabstrip of IsBreak=true to allow for stacked tabs instead of scrolling tabs?
or if anyone has accomplished the stacked tabs.
basically our system has about 15 tabs that need to be a in a single tab strip control and the scrolling makes this basically un-usable for clients and they are used to our old application with stacked tabs on the top of the tab strip.
Hello,
I am using a Grid Custom Editor for ASP.NET MVC. When updating, the CohortAttributes_Update method is called (verified by breakpoint in Visual Studio), however IEnumerable<ContractMultiselectXrefModel> contractMultiSelectXrefs is set to a null value. I have followed this guide for implementation: https://demos.telerik.com/aspnet-mvc/grid/editing-custom
ContractMultiselectXrefsController
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult CohortAttributes_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<ContractMultiselectXrefModel> contractMultiSelectXrefs)
{
db.Configuration.ProxyCreationEnabled = false;
if (contractMultiSelectXrefs != null && ModelState.IsValid)
{
foreach (var contractMultiSelectXref in contractMultiSelectXrefs)
{
contractMultiselectService.Update(contractMultiSelectXref);
}
}
return Json(contractMultiSelectXrefs.ToDataSourceResult(request, ModelState));
}
Index.cshtml
@(Html.Kendo().Grid<HI_ACO_Tool.Models.RAD.ContractFeeXrefModel>
()
.Name("CohortFees")
.Columns(columns =>
{
columns.Bound(contract => contract.ContractFeeModel).ClientTemplate("#=ContractFeeModel.FeeNM#").Title("Fee");
columns.Bound(contract => contract.Amount);
columns.Bound(contract => contract.BeginDT).Title("Attribute start date").Format("{0: MM/dd/yyyy}");
columns.Bound(contract => contract.EndDT).Title("Attribute end date").Format("{0: MM/dd/yyyy}");
columns.Command(command => { command.Destroy(); }).Width(100);
})
.ToolBar(toolBar =>
{
toolBar.Create().Text("Add Fee");
toolBar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource // Configure the grid data source
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.FeeXrefKey);
model.Field(p => p.ContractCohortKey);
model.Field(p => p.FeeKey);
model.Field(p => p.ContractFee);
model.Field(p => p.Amount);
model.Field(p => p.BeginDT);
model.Field(p => p.EndDT);
})
.Read(read => read.Action("ContractFeeGrid_Read", "ContractFee").Data("cohortInfo()"))
.Update(update => update.Action("ContractFeeGrid_Update", "ContractFee"))
)
)
Hi,
how can I toggle the drawer mini mode / expanded mode from within the drawer itself.
The samle code I found has the toggle button in some other control, for example the toolbar.
I would like to have the drawer in mini mode and one item in the drawer to expand / collapse it.
When I expand the drawer from a handler function for itemClick, it expands but collapses at the end of the handler.
Regards
Erwin
telerik mvc window: change the url of window when iframe is set to true
My goal is to have a set of windows for a page and for the content to not be loaded until the first time the window is opened.
Each window has a maximize, minimize, and refresh button.
Here is the script to load a window.
var w = $(id).data('kendoWindow');
var url = $(id).data('url');
var loaded = $(id).data('load');
if (loaded == null) {
w.refresh({
url: url
});
w.setOptions({
contentUrl: url,
});
$(id).data('load', 'false');
}
However, with this approach, the "refresh" button on the window seems to have no effect after the content loads.
How can I maintain the URL so the window'scontent can be loaded programmatically and the refresh button reload the content?
I added a new column to my grid but it's not showing up because I'm using the setOptions method along with localStorage to save the grid options and it must be overriding the grid columns. How can I reset/clear localStorage so that the grid gets updated properly in the browser? Here is the relevant JS code:
$(function () {
var grid = $("#reviewsGrid").data("kendoGrid");
var options = localStorage["pat-sessions-options"];
if (options) {
var parsedOptions = JSON.parse(options);
parsedOptions.toolbar = [
{ template: $("#toolbarTemplate").html() }
];
parsedOptions.columns[0].headerTemplate = $("#emptyHeaderTemplate").html();
grid.setOptions(parsedOptions);
}
});
function onDataBoundPATItems(e) {
var grid = $("#reviewsGrid").data("kendoGrid");
localStorage["pat-sessions-options"] = kendo.stringify(grid.getOptions());
}
Hello,
I'm currently trying to make the grid's on our website persisted but have a couple of questions:
1. Persisting Columns with Multicheck Filters
When I try and open the column menu on a column that has multi check filter, it errors. It's the exact same issue as in https://www.telerik.com/forums/multi-check-box-filter-and-persistance but the answer was from 2 years ago. Is there an update to this?
2. Handling data changes
What happens when you add, remove or rename a column? Is there a way to compare the saved (in local storage) columns and see if there are any differences? If so, delete the saved grid settings as it's now incorrect?
Thank you
Lucy
Hi,
I have implemented the filter multi check as described here:
http://demos.telerik.com/aspnet-mvc/grid/filter-multi-checkboxes
and I have persisted the grid using the methods described here:
http://demos.telerik.com/aspnet-mvc/grid/persist-state
For the checkboxes, I have a method server side which returns the filter checkboxes as Json.
Code Snippet:
@(Html.Kendo().Grid<DefectNotificationReportItemDto>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.MaterialCode).Width(140).Filterable(f => f.Multi(true).ItemTemplate("itemTemplate").Search(true).DataSource(source => source.Read(r => r.Action("GetMaterialCodes", "DefectNotificationReport", new { selectedSnapshotDate = Model.ToString("dd MMM yyyy") }))));
columns.Bound(p => p.MaterialDescription).Width(300).Filterable(f => f.Multi(true).ItemTemplate("itemTemplate").Search(true).DataSource(source => source.Read(r => r.Action("GetMaterialDescriptions", "DefectNotificationReport", new { selectedSnapshotDate = Model.ToString("dd MMM yyyy") }))));
columns.Bound(p => p.BatchNumber).Width(140).Filterable(f => f.Multi(true).ItemTemplate("itemTemplate").Search(true).DataSource(source => source.Read(r => r.Action("GetBatchNumbers", "DefectNotificationReport", new { selectedSnapshotDate = Model.ToString("dd MMM yyyy") }))));
}
function itemTemplate(e) {
if (e.field === "all") {
//handle the check-all checkbox template
return "<div><label><strong><input type='checkbox' />#= all#</strong></label></div>";
} else {
//handle the other checkboxes
return "<div class='kendo-custom-filter'><span><label><input type='checkbox' name='" + e.field + "' value='#=Value#'/><span>#= Text #</span></label></span></div>";
}
}
Everything works fine, until the state of the grid is reloaded. If I then click on a filter I get a JavaScript error:
VM12456:3 Uncaught ReferenceError: BatchNumber is not defined
at eval (eval at compile (kendo.all.js:194), <anonymous>:3:209)
at Object.render (kendo.all.js:175)
at Object.proxy [as render] (jquery-3.1.1.js:502)
at init.createCheckBoxes (kendo.all.js:37796)
at init.refresh (kendo.all.js:37762)
at init.options.forceUnique.checkChangeHandler (kendo.all.js:37614)
at init.trigger (kendo.all.js:124)
at init._process (kendo.all.js:6965)
at init.success (kendo.all.js:6710)
at success (kendo.all.js:6637)
I find all of your features are great in isolation but when combined this sort of things happens. Please can you tell me why this happens and how I can fix the issue?
Thanks