Hi I need a column.which needs to be editable in inline edit mode and should be non editable at insert mode.As well we need to have two different list in either case.in insert mode only filtered list should be shown and in edit mode all record should be shown in grid columns dropdown.
Hi ,
I just updated my libraries to the latest one 2016.1.112.545 and now the bottom border of an input widget is missing at a particular zoom level in Chrome browser but it works fine in IE and Firefox. Any help appreciated.
Thank you
Below is code where I am trying to create master detail grids where data is fed through list of objects. When I run it I do get master detail grids, but when I try to do sorting, filtering, paging, I lose my page and I am sent back to home page. And If I use alternate DataSource code as below I get error "Cannot use only server templates in Ajax or WebService binding mode. Please specify a client template as well."
Please advice. Thanks.
My model is something like this
public partial class Invoice
{
public int InvoiceNumber{ get; set; }
..
..
public List<IvDetail> IvDetails { set; get; }
}
And here is view code.
@model IEnumerable<Portal.Models.Invoice>
@{ Html.Kendo().Grid(Model)
.Name("InvoiceGrid")
.Pageable()
.Columns(columns =>
{
columns.Bound(p => p.InvoiceNumber).Filterable(true).Title("Invoice Number");
columns.Bound(p => p.InvoiceDate).Title("Invoice Date");
columns.Bound(p => p.InvoiceTotal).Title("Invoice Total");
columns.Bound(p => p.Balance).Title("Balance");
})
.Filterable()
.Sortable()
.Navigatable()
.DataSource(dataSource => dataSource.Server().PageSize(15))
// this gives error "Cannot use only server templates in Ajax or WebService binding mode. Please specify a client template as well."
//.DataSource(datasource => datasource
// .Ajax()
// .PageSize(15)
// .ServerOperation(false)
// .Sort(sort =>
// {
// sort.Add(p => p.InvoiceNumber);
// })
// )
.DetailTemplate(
@<text>
@(Html.Kendo().Grid(item.IvDetails)
.Name("IvDetails_" + item.InvoiceNumber)
.Columns(columns =>
{
columns.Bound(o => o.ItemNumber);
columns.Bound(o => o.PartNumber);
columns.Bound(o => o.Description);
})
.DataSource(dataSource => dataSource.Server().PageSize(15))
.Pageable()
.Sortable()
.Filterable()
)
</text>
)
.Sortable()
.Render();
}
Hi everyone,
I'm trying to add an EditorTemplate for an autocomplete column. However, when I add the template, the only way for the grid to get populated is to select from the dropdown. If I don't select from the dropdown, then the autocomplete does not populate the grid column with the text. My code is below. Any help is much appreciated. Thank you for your time.
Bret Mullinix
Column From Grid -->
columns.Bound(l => l.AssetObject).Width(200) .ClientTemplate(" #: data.AssetObject ? data.AssetObject.SerialNumber : getSerialNumber(this, data) #" + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.AssetTypeId' " + " value=' #: data.AssetObject ? data.AssetObject.AssetTypeId : '[None]' #' /> " + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.SerialNumber' " + " value=' #: data.AssetObject ? data.AssetObject.SerialNumber : '[None]' #' /> " + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.Id' " + "value='#: data.AssetObject ? data.AssetObject.Id : 0 #' />" + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.Responsible' " + "value='#: data.AssetObject ? data.AssetObject.Responsible : '' #' />" + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.Disposition' " + "value='#: data.AssetObject ? data.AssetObject.Disposition : '' #' />" + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.ResponsibleId' " + "value='#: data.AssetObject ? data.AssetObject.ResponsibleId : 0 #' />" + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.DispositionId' " + "value='#: data.AssetObject ? data.AssetObject.DispositionId : 0 #' />" + "<input type='hidden' name='ShipmentItems[#= index(data)#].AssetObject.OwnerId' " + "value='#: data.AssetObject ? data.AssetObject.OwnerId : 0 #' />" ) .EditorTemplateName("AssetSerialNumberAutoComplete");EditorTemplate: AutoSerialNumberAutoComplete
@using Kendo.Mvc.UI@using DataTransferObjects@model AssetDTO@(Html.Kendo().AutoComplete() .Name("AssetSerialNumberAutoComplete") .DataTextField("SerialNumber") .Events(e => e.Change("onSerialNumberChange")) .DataSource(source => { source.Read(read => { read.Action("GetAssetBySerialNumber", "Asset").Data("onAdditionalDataForAssetSerialNumber"); }); source.ServerFiltering(true); }) .HtmlAttributes(new { style = "width:100%", data_skip = "false", data_bind = "defferedValue: AssetObject" }) .Filter("startswith") .MinLength(2) .Height(400) .HeaderTemplate("<div class=\"col-sm-12\">" + "<div class=\"col-sm-6\">SerialNumber</div>" + "<div class=\"col-sm-6\">Asset Type</div>" + "</div><br/>") .Template("<div class=\"col-sm-12\">" + "<div class=\"col-sm-6\">#: data.SerialNumber #</div>" + "<div class=\"col-sm-6\">#: data.AssetType #</div>" + "</div>") )<script> var autoComplete = $("#AssetSerialNumberAutoComplete").data("kendoAutoComplete"); autoComplete.list.width(600); //adjust width of the drop-down list</script>There are several topics on this forum regarding linking Grid columns to Dictionary properties. I've managed to do just that, but these columns are missing sorting and dropdown menu.
My model represents an issue from issue tracking system that may have very different fields depending on particular configuration. I can't see it feasible to define each possible property for my model class and the only logical solution is to have direct properties for most common fields and have a Dictionary for custom fields.
I'm using Kendo.MVC version 2016.1.112 in MVC 6 / .NET 5 project (which currently doesn't support server-side binding as far as I understand - rendering some solutions posted on this forum inapplicable). Browser is Chrome, but it doesn't seem the issue relates to browser version.
My model class is as follows:
public class Issue{ public string Key { get; set; } public string Summary { get; set; } public string Status { get; set; } public string StatusType { get; set; } public DateTime? Created { get; set; } public DateTime? LastUpdated { get; set; } public Dictionary<string, object> CustomProperties { get; set; } = new Dictionary<string, object>();}
The Grid is then defined in View's *.cshtml file as this:
@(Html.Kendo().Grid<JIRAReports.Models.Issue>() .Name("grid") .HtmlAttributes(new { style = "margin-top: 10px;" }) .DataSource(dataSource => dataSource.Ajax() .Sort(sort => sort.Add("LastUpdated").Ascending()) .Read(read => read.Action("JiraIssues_Read", "Reports")) .PageSize(15) ) .Columns(columns => { columns.Bound(issue => issue.Key).Width(120).HtmlAttributes(new { style = "white-space: nowrap;" }) .ClientTemplate($"<a href=\"{baseIssueUrl}#=Key#\" target=\"_blank\">#=Key#</a>"); columns.Bound(issue => issue.Status).Width(150) .ClientTemplate(statusColumnTemplate); columns.Bound(issue => issue.Summary).HtmlAttributes(new { style = "white-space: nowrap;" }); columns.Bound(issue => issue.LastUpdated).Width(180).HtmlAttributes(new { style = "white-space: nowrap;" }) .Title("Last Updated").Format("{0:M/d/yyyy (ddd)}"); //Adding custom properties columns.Template("#:CustomProperties['CustomProperty1']#").Title("Custom Property 1"); columns.Template("#:CustomProperties['CustomProperty2']#").Title("Custom Property 2").Hidden(); }) .Pageable(config => config.PageSizes(new[] { 10, 15, 25, 100 }) .Refresh(true)) .Sortable(config => config.AllowUnsort(false).SortMode(GridSortMode.MultipleColumn)) .Scrollable(config => config.Height("895px")) .Resizable(config => config.Columns(true)) .ClientDetailTemplateId("item-template") .ToolBar(tools => tools.Custom().Text("Expand All").Name("ExpandAll")) .ToolBar(tools => tools.Custom().Text("Collapse All").Name("CollapseAll")) .NoRecords() .ColumnMenu() .Reorderable(config => config.Columns(true)) .Deferred()
The resulting grid is rendered as on the screenshot attached. You can see there is no dropdown next to columns linked to Dictionary's items, they are not sortable, but these columns do appear in dropdowns for other columns so they can be shown/hidden. But sorting on them is absolutely required.
Please suggest a solution. There must be a way to link to less structured data or indexer property, especially since all we need is to display it in read-only mode.
I'm bundling all my updates into one request by using the method suggested in the example "GridSyncChangesWithOneRequest".
The actual call is:
$.ajax({ url: "/Home/UpdateCreateDelete", data: data, type: "POST", error: function () { //Handle the server errors using the approach from the previous example }, success: function () { alert("update on server is completed"); grid.dataSource._destroyed = []; //refresh the grid - optional grid.dataSource.read(); }}) When using TreeList widget with a simple model like this:
public class MyModel
{
public int? Id {get;set;}
public int? ParentId {get;set;}
public string Name {get;set;}
}
...
@(Html.Kendo().TreeList<MyModel>().Name("treeList")
.Toolbar(t=>t.Create())
.Editable(e=>e.Mode("popup"))
.DataSource(ds=>ds
.Model(m=>
{
m.Id(f=>f.Id);
m.ParentId(f=>f.ParentId);
m.Field(f=>f.Name);
})
.Create(c=>c.Action("Create", "My"))
)
.Columns(c=>
{
c.Add().Field(f=>f.Id);
c.Add().Field(f=>f.ParentId)
c.Add().Field(f=>f.Name)
})
)
When filling the popup, there are no error, but the item is NOT inserted in the treeList. If I change the type of the Id and ParentId to non nullable, the problem is solved.
In your demo, the model seems to have nullable fields as Id and ParentId, but there are no demo of item creation. Is it a bug or something missing in my code?When using TreeList widget with a simple model like this:
public class MyModel
{
public int? Id {get;set;}
public int? ParentId {get;set;}
public string Name {get;set;}
}
...
@(Html.Kendo().TreeList<MyModel>().Name("treeList")
.Toolbar(t=>t.Create())
.Editable(e=>e.Mode("popup"))
.DataSource(ds=>ds
.Model(m=>
{
m.Id(f=>f.Id);
m.ParentId(f=>f.ParentId);
m.Field(f=>f.Name);
})
.Create(c=>c.Action("Create", "My"))
)
.Columns(c=>
{
c.Add().Field(f=>f.Id);
c.Add().Field(f=>f.ParentId)
c.Add().Field(f=>f.Name)
})
)
When filling the popup, there are no error, but the item is NOT inserted in the treeList. If I change the type of the Id and ParentId to non nullable, the problem is solved.
In your demo, the model seems to have nullable fields as Id and ParentId, but there are no demo of item creation. Is it a bug or something missing in my code?
Regards
Filter option is working with columns not having clientTemplates like AccountName but not in others.
In synchronous mode, it's easy to take a server side action when all files are processed via foreach (var file in files), when it is completed. But how to do this in async mode? The server controller has no notion of the total number of files. And I don't see an Event fired when all the files are upload, although the control has the "Done" UI indication.
thanks, Tom