Hello,
I have a Kendo Grid with a command column, that on clicking shows extra details for that row. I want to show this extra information in a Kendo Window. I have been able to achieve this. Next, I want to add a button inside this Kendo Window, that allows user to show the details for the next grid row, without having to go back to the grid. I am having some trouble with this. Few notes about the Kendo Window -
1. The contents of the Kendo Window is displayed using a Script template. I am passing the grid's current dataItem to the template to render HTML. More on this in #3
2. The user can have multiple such grids open in the same window, and hence multiple Kendo Windows, so it's not practical to save the current row number and grid # in JS. The number of the grids is dynamic, so there is no id associated with any of them.
3. To work around #2, instead of passing the grid's dataItem, I have an object that passes the entire data associated with the grid and the current index of the grid. The data in the grid is pretty small, so I am not too worried about passing entire data. In this approach, I was hoping, on the Next Button click action, I can retrieve the object passed earlier, and then increment the index. However, when I use Kendo Window's content(), I get a string back with HTML. I am guessing this is due to the Script template. I am not sure how to proceed with this approach. Is there a way to extract the underlying object that was passed to the script template?
Also, the approach in #3 seems very crude to me. Is there a better way to implement the functionality I am looking for? I looked around some of the other Kendo UI widgets, and Scrollview seemed like what I needed (minus the drag scroll). But it looks like scrollview is meant for mobile only?
Thanks,
Avnish
I added a Kendo Editor along with the FileBrowserController and ImageBrowserController per the example - File and Image Browser. My problem is the filter prevents all files from displaying. If the filter is in place I can't see any files in the directory even though there are files there with the correct extensions. If I comment out the filter I can see the files. I can see the Filter value getting set correctly in the debugger. Not sure how to fix this.
public class FileBrowserController : EditorFileBrowserController{ private const string contentFolderRoot = "~/Content/"; private const string prettyName = "Documents"; /// <summary> /// Gets the base paths from which content will be served. /// </summary> public override string ContentPath { get { return CreateUserFolder(); } } /// <summary> /// Gets the valid file extensions by which served files will be filtered. /// </summary> public override string Filter { get { return "*.txt, *.doc, *.docx, *.xls, *.xlsx, *.ppt, *.pptx, *.jpg, *.jpeg, *.gif, *.png, *.pdf"; } } private string CreateUserFolder() { var virtualPath = Path.Combine(contentFolderRoot, "Clients", prettyName); var path = Server.MapPath(virtualPath); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } return virtualPath; }}
@(Html.Kendo().Editor() .Name("editor") .HtmlAttributes(new { style = "height:440px" }) .Tools(tools => tools.Clear().InsertImage().InsertFile()) .Value(@<text> <p> Kendo UI Editor allows your users to edit HTML in a familiar, user-friendly way.<br /> In this version, the Editor provides the core HTML editing engine, which includes basic text formatting, hyperlinks, lists, and image handling. The widget <strong>outputs identical HTML</strong> across all major browsers, follows accessibility standards and provides API for content manipulation. </p> <p>Features include:</p> <ul> <li>Text formatting & alignment</li> <li>Bulleted and numbered lists</li> <li>Hyperlink and image dialogs</li> <li>Cross-browser support</li> <li>Identical HTML output across browsers</li> <li>Gracefully degrades to a <code>textarea</code> when JavaScript is turned off</li> </ul> <p> Read <a href="http://docs.telerik.com/kendo-ui">more details</a> or send us your <a href="http://www.telerik.com/forums">feedback</a>! </p> </text>) .ImageBrowser(imageBrowser => imageBrowser .Image("~/Content/Clients/Images/{0}") .Read("Read", "ImageBrowser") .Create("Create", "ImageBrowser") .Destroy("Destroy", "ImageBrowser") .Upload("Upload", "ImageBrowser") .Thumbnail("Thumbnail", "ImageBrowser")) .FileBrowser(fileBrowser => fileBrowser .File("~/Content/Clients/Documents/{0}") .Read("Read", "FileBrowser") .Create("Create", "FileBrowser") .Destroy("Destroy", "FileBrowser") .Upload("Upload", "FileBrowser") ))I have a grouped datasource. The datasource appears to only let me filter by the "value" / grouped item. How do I filter on properties such as name that are in the grouped items, "items" collection?
When I clicked Add or Edit button of Grid, it is centered correctly in computer. When it is in IPAD, the popup will go to the top right corner. I guess it could be bootstrap or accordion container of my settings. Is there a way I can tell the popup of Add window to show in the middle or on top left corner?
Thanks.
I have seen the demo where you are using SignalR and entity framework to bind to a Kendo scheduler. I have tried using this but have all sorts of problems.
Is there a way to use Linq rather than EF as I'm more familiar with this?
This is my schedular initialisation code...
////initialise scheduler$("#scheduler").kendoScheduler({ date: Date.now(), timezone: "Europe/London", workDayStart: new Date("2013/1/1 08:00 AM"), workDayEnd: new Date("2013/1/1 8:00 PM"), dateHeaderTemplate: kendo.template("<strong>#=kendo.toString(date, 'ddd dd/M')#</strong>"), selectable: true, messages: { ariaSlotLabel: "Selected from {0:g} to {0:g}", showWorkDay: "Show core work hours" }, editable: { window: { title: "Work Request", width: "720px" }, template: $("#customEditorTemplate").html() }, height: 400, views: [ { type: "day", editable: { destroy: false } }, { type: "week", editable: { destroy: false }, eventHeight: 40 }, { type: "timeline", editable: { destroy: false }, eventHeight: 40 }, { type: "timelineWeek", selected: true, majorTick: 1440, minorTickCount: 1, editable: { destroy: false }, eventHeight: 40 }, { type: "agenda" }, { type: "month", editable: { destroy: false }, eventHeight: 40 } ], timezone: "Etc/UTC", dataSource: { type: "signalr", push: function (e) { var notification = $("#notification").data("kendoNotification"); notification.success(e.type); }, transport: { signalr: { hub: sHub, promise: sHubStart, server: { read: "read", create: "create", update: "update", destroy: "destroy" }, client: { read: "read", create: "create", update: "update", destroy: "destroy" } } }, schema: { model: { id: "wRequestID", fields: { wRequestId: { editable: false, from: "WRequestID", type: "number", defaultValue: 0 }, start: { from: "Start", type: "date", culture: "en-GB" }, end: { from: "End", type: "date", culture: "en-GB" }, diary: { from: "Diary", type: "object", defaultValue: "UIS" }, team: { from: "Team", type: "object" }, title: { from: "Title", type: "string", validation: { required: true } }, workManager: { from: "WorkManager", type: "object" }, assignee: { from: "Assignee", type: "object" }, changeRef: { from: "ChangeRef", type: "string", validation: { required: true } }, activity: { from: "Activity", type: "string", validation: { required: true } }, impactedServers: { from: "ImpactedServers", type: "string", validation: { required: true } }, impactedServices: { from: "ImpactedServices", type: "string", validation: { required: true } }, isBAU: { from: "IsBAU", type: "boolean", defaultValue: false }, projectRef: { from: "ProjectRef", type: "string", validation: { required: true } }, notes: { from: "Notes", type: "string" }, isOOH: { from: "IsOOH", type: "boolean", defaultValue: false }, isAllDay: { from: "IsAllDay", type: "boolean", defaultValue: false }, recurrenceRule: { from: "RecurrenceRule", type: "string" }, recurrenceId: { from: "RecurrenceID", type: "number" }, recurrenceException: { from: "RecurrenceException", type: "string" }, startTimezone: { from: "StartTimezone", type: "string" }, endTimezone: { from: "EndTimezone", type: "string" } } }, }, }, resources: [ { field: "team", dataSource: [ { text: "Team 1", value: "Team 1", color: "#f8a398" }, { text: "Team 2", value: "Team 2", color: "#51a0ed" }, { text: "Team 3", value: "Team 3", color: "#56ca85" } ], title: "Team" }, { field: "workManager", dataSource: [ { text: "Manager 1", value: "12345", color: "#f8a398" }, { text: "Manager 2", value: "23456", color: "#51a0ed" }, { text: "Manager 3", value: "34567", color: "#56ca85" } ], title: "Work Manager", }, { field: "assignee", dataSource: [ { text: "Alex", value: "12345", color: "#f8a398" }, { text: "Bob", value: "23456", color: "#51a0ed" }, { text: "Charlie", value: "34567", color: "#56ca85" } ], title: "Assigned To" } ], edit: function(e) { var container = e.container; /* ACTION: ADD custom button */ var newButton = $('<a class="k-button" href="#">New button</a>'); //wire its click event newButton.click(function(e) { alert("Clicked"); }); //add the button to the container var buttonsContainer = container.find(".k-edit-buttons"); buttonsContainer.append(newButton); }}); Hi,
I am using Aurelia with Kendo UI. I tried the context menu. I am having problems in calling a function from the select. It is unable to locate that method.
$("#menu").kendoContextMenu({ orientation: orientation, target: "#listview-context-menu", filter: ".product", animation: { open: { effects: "fadeIn" }, duration: 500}, select: function (e) { this.doAction(); // this function is not being recognized. }});
Can you please help?
Hi,
I wanted to change the way to choose foreColor and backColor using the kendoColorPicker.
The default way use kendoColorPallet.
I can't find anything on internet.
Can you help ?
Hi,
Initially i had Grid with CRUD operations working properly and after adding sortable now sortable is working fine but CRUD is not working
if i remove sortable crud is working fine. I need to make both working where am i making mistake
$(document).ready(function () {
function dataSource_change(e) {
var data = this.data();
console.log(data.length); // displays "77"
}
var dataSource = new kendo.data.DataSource({
//pageSize: 20,
transport:{
read:{
url: function() {
return "/makes"},
dataType: "json",
cache: false
},
update: {
url: function (make) {
console.log(make)
return "/makes/"+ make.models[0].id
},
type: "PUT",
dataType: "json",
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token',jQuery('meta[name="csrf-token"]').attr("content")); }
},
destroy: {
url: function (make) {
return "/makes/"+ make.models[0].id
},
type: "DELETE",
dataType: "json"
},
create: {
url: "/makes",
type: "POST",
dataType: "json"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
console.log(options)
return{"make": options.models[0]};
}
else{
return {"make":options};
}
}
},
batch: true,
schema: {
model: {
id: "id",
fields: {
id: { editable: false, nullable: true },
name: { validation: { required: true } },
}
}
}
});
dataSource.bind("change", dataSource_change);
dataSource.fetch();
var grid = $("#grid").kendoGrid({
dataSource: dataSource,
pageable: false,
height: 550,
toolbar: [{name: "create", text: "Add New Make"}],
columns: [
{ field:"name",title:"Makes" },
{ command: ["edit", "destroy"], title: "Action", width: "250px" }],
editable: "inline"
}).data("kendoGrid");
grid.table.kendoSortable({
filter: ">tbody >tr",
hint: $.noop,
cursor: "move",
placeholder: function(element) {
return element.clone().addClass("k-state-hover").css("opacity", 0.65);
},
container: "#grid tbody",
change: function(e) {
console.log(grid)
var skip = grid.dataSource.skip(),
oldIndex = e.oldIndex + skip,
newIndex = e.newIndex + skip,
data = grid.dataSource.data(),
dataItem = grid.dataSource.getByUid(e.item.data("uid"));
var updated_order = []
$('tbody tr').each(function(i){
updated_order.push({ name: $(this).children('td:first').text(), position: i+1 });
});
controller_name = $('#controller_name').val();
$.ajax({
type: "PUT",
url: '/sort',
data: { order: updated_order, controller_name: controller_name }
});
grid.dataSource.remove(dataItem);
grid.dataSource.insert(e.newIndex, dataItem);
}
});
});
Hi,
I'm trying to pass in DataSourceRequest instance to a web api method (POST), and can't find the model binder for it.
Here's my scenario in short:
1) Kendo Grid uses MVC controller action to get the data, and DataSourceRequest is binded ok.
2) In turn, the MVC action needs to call a web api url (using post), and include the DataSourceRequest as content (json format)
I checked this article: http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/web-api-server-operations
But it only discusses the GET request, and when grid is directly calling web api.
Is there a json model binder for DataSourceRequest, for web api?