Hi
I have got an issue where there is a 35px wide gap at the left hand side of all my line graphs.
Please see here for a demo
http://vsdash-test.azurewebsites.net/
I would like the line graph to display the full width of the blue area, and remove the blank space to the left.
When i expect the code, I am inside the markup used to create the SVG file.
Is there anyway I can remove this space at the left side?
Thank you for your time.
I added a resource using the following code:
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.resources[0].dataSource.add({
Text: "aaaaaBBBBBB",
Value: 23,
Color: "#FFFFFF"
});
scheduler.view(scheduler.view().name);
How can I get the resources to sort by Text so that it shows up in order and not at the end?
I am using a Kendo MVC Scheduler control with a TimeLine view and I am adding new events via an ajax call to my server to add to a table that holds scheduler events. I need a way to refresh the scheduler or to add an event manually just so it will show up until the next refresh. Is there an easy way to do that?
I tried the following but it doesn't call my read method:
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.resources[0].dataSource.read().then(
function () {
scheduler.view(scheduler.view().name);
});
This is my client side code:
<% Html.Kendo().Scheduler<WheresMyTool.Models.MeetingViewModel>()
.Name("scheduler")
.Date(new DateTime(2016, 12, 16))
.StartTime(new DateTime(2016, 12, 16, 7, 00, 00))
.MajorTick(60)
.EventTemplate(
"<div class='#= eventStyle #' title='#= description #'>" +
"#= title #" +
"</div>")
.Views(views =>
{
views.TimelineWeekView(timeline =>
{
timeline.EventHeight(25);
timeline.ColumnWidth(1);
});
views.TimelineView(timeline =>
{
timeline.EventHeight(25);
timeline.ColumnWidth(10);
});
views.TimelineMonthView(timeline =>
{
timeline.StartTime(new DateTime(2016, 12, 16, 00, 00, 00));
timeline.EndTime(new DateTime(2016, 12, 16, 00, 00, 00));
timeline.MajorTick(1440);
timeline.MinorTickCount(1);
timeline.EventHeight(25);
timeline.ColumnWidth(10);
});
})
.Editable(a => a.Confirmation(false))
.Timezone("Etc/UTC")
.Group(group => group.Resources("Attendees").Orientation(SchedulerGroupOrientation.Vertical))
.Events(e =>
{
e.DataBound("schedulerDataBound");
e.Edit("scheduler_edit");
e.Add("scheduler_add");
})
.Resources(resource =>
{
resource.Add(m => m.Attendees)
.Title("Attendees")
.Name("Attendees")
.Multiple(true)
.DataTextField("Text")
.DataValueField("Value")
.DataColorField("Color")
.BindTo(Model.resourceList);
})
.DataSource(d => d
.AutoSync(true)
.Read("SchedulerRead", "Scheduler")
.Create("SchedulerCreate", "Scheduler")
).Render();
%>
Hi,
I was hoping someone could help me with the issue I have in storing the order of sortable panels within the local storage.
Here is some example code I am using:
-----------------------------------------------------------------------------------------
.........
string name = string.Format("main-content{0}", colCounter);
<div id = "@name" >
@{
foreach (var colItem in cols)
{
@renderTiles(colItem);
}
}
</div>
..................
@(Html.Kendo().Sortable()
.For("#main-content1")
.ConnectWith("#main-content2,#main-content3")
.Cursor("move")
.PlaceholderHandler("placeholder")
.HintHandler("hint")
)
@(Html.Kendo().Sortable()
.For("#main-content2")
.ConnectWith("#main-content1,#main-content3")
.Cursor("move")
.PlaceholderHandler("placeholder")
.HintHandler("hint")
)
@(Html.Kendo().Sortable()
.For("#main-content3")
.ConnectWith("#main-content1, #main-content2")
.Cursor("move")
.PlaceholderHandler("placeholder")
.HintHandler("hint")
)
.............
<script>
var localStorageSupport = (('localStorage' in window && window['localStorage'] !== null)),
data,
html;
if (localStorageSupport) {
data = JSON.parse(localStorage.getItem("sortableData"));
} else {
alert("your browser does not support local storage");
}
$(document).ready(function ()
{
$('.widget').click(function (e) {
window.location.href = $(e.target).attr('href');
})
$('.widget').change(function (e) {
var item = data.splice(e.oldIndex, 1)[0];
data.splice(e.newIndex, 0, item);
localStorage.setItem("sortableData", kendo.stringify(data))
})
})
</script>
@helper renderTiles(IPublishedContent Section)
{
var title = Section.GetPropertyValue<string>("tiitle", String.Empty);
var icon = Section.GetPropertyValue<string>("icon", String.Empty);
int intLink = Section.GetPropertyValue<int>("intLink", 0);
var extLink = Section.GetPropertyValue<string>("extLink", String.Empty);
var imgId = Section.GetPropertyValue("icon", -1);
var Url = string.Empty;
if (@intLink == 0 && @extLink.Length > 0)
{
Url = @extLink;
}
else if (@intLink != 0 && @extLink.Length == 0)
{
Url = Umbraco.NiceUrl(@intLink);
}
<div id="panes" class="widget" header="@title" href="@Url">
<div header="@title" href="@Url">
@title
<div class="widget-image" header="@title" href="@Url">
@if (imgId != -1)
{
<img src="@Umbraco.TypedMedia(imgId).Url" alt="=@Umbraco.TypedMedia(imgId).Name" title="@title" header="@title" href="@Url" />
}
</div>
</div>
</div>
}
I have looked at the following:
http://docs.telerik.com/kendo-ui/controls/interactivity/sortable/overview
http://docs.telerik.com/kendo-ui/controls/interactivity/sortable/how-to/persist-order-in-localstorage
http://www.telerik.com/forums/saving-sortable-state
These do make sense but I am having a bit of a senior moment with what I am trying to do.
Many thanks.
J
@model IEnumerable<
HCS.Model.FinancialInstitution
>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.MainRT).Groupable(false);
columns.Bound(p => p.LegalName);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false))
)
@model IEnumerable<
HCS.Model.FinancialInstitution
>
@(Html.Kendo().Window()
.Name("window")
.Title("Choose a Financial Institution (FI)")
.Content(() =>
{
@Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.MainRT).Groupable(false);
columns.Bound(p => p.LegalName);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false));
})
.Draggable()
.Resizable()
.Events(ev => ev.Close("onClose"))
.Width(400)
)
I am unable to figure out why the HttpPostedFileBase is always null in my upload widget. Sample Project showing the issue.
View
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<
div
class
=
"row row-spacing-bottom"
>
<
div
class
=
"col-md-12"
>
@(Html.Kendo().Upload()
.Name(Html.IdFor(model => model.HttpPostedFileBase).ToString())
.Multiple(false)
.Messages(m => m.Select("Select a File"))
.Events(e => e.Select("uploadHelper.checkFileSize"))
.Deferred())
</
div
>
</
div
>
<
div
class
=
"row"
>
<
div
class
=
"col-md-12"
>
@(Html.Kendo().Button()
.Name("Submit")
.Content("Upload File")
.HtmlAttributes(new {type = "submit"})
.Deferred())
</
div
>
</
div
>
}
Controller:
public
class
FileUploadController : Controller
{
public
ActionResult FileUpload()
{
return
View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public
ActionResult FileUpload(Models.FileUpload fileUpload)
{
var result = fileUpload.HttpPostedFileBase !=
null
;
return
Json(
new
{success = result});
}
}
Submit function:
$(
'form'
).submit(
function
() {
layout.showLoadingScreen(
true
);
$.ajax({
url:
this
.action,
type:
this
.method,
data: $(
this
).serialize(),
success:
function
(result) {
if
(result.success) {
layout.showNotification(
"Save Successful"
,
"success"
);
layout.showLoadingScreen(
false
);
}
else
{
layout.showNotification(
"Error Saving Record"
,
"error"
);
layout.showLoadingScreen(
false
);
}
}
});
return
false
;
});
Hello guys.
Unfortunately, I've found an error in Kendo (there is no such error in 2015.3.930.545 (just for information))
Check the example project.
https://www.dropbox.com/s/7h8gm1ekyui56qq/KendoUI.rar?dl=0
Description:
- I have two grids.
- They both have a field "Volume" and calculate the sum of this field.
- They don't have any other aggregates for other fields. (it's important)
What I have:
1) Static class "ClassFactory" ("~/Infrastructure/Implementation/ClassFactory.cs") which has a variable Dictionary<Signature, Type> classes.
2) Class "Signature" ("~/Infrastructure/Implementation/Signature.cs") that has a method "Equals"
3) ArgumentException
Description:
When one of grid sends a request to controller, some manipulations are performed and we find ourselves in "ClassFactory" in a method "GetDynamicClass". Here a variable (name - signature) of type "Signature" is added to the variable "classes" of type "Dictionary<Signature, Type>". No problems, everything is fine. Then another grid does the same steps. But now, when the variable "signature" is being added to the variable "classes", I get exception "ArgumentException". Why? Look at the code of the method "Equals" of the class 'Signature':
if (poperties.Length != other.properties.Length) return false;
for (int i = 0; i < properties.Length; i++)
{
if (properties[i].Name != other.properties[i].Name || properties[i].Type != other.properties[i].Type)
return false;
}
return true;
Aggregates for the first grid: Sum_Volume for the field "Volume"
Aggregates for the second grid: Sum_Volume for the field "Volume"
Conclusion:
Aggregates are the same, so the method "Equals" returns true
And that's why I get "ArgumentException" (An item with the same key has already been added)
Solution:
People who have the same error:
You can:
1) Add the hidden field to the grid (to the model) and aggregate sth (for ex: sum) for this field. (if you have more than 2 grids with such problem, don't forget that these hidden fields must have different names, otherwise it won't help)
2) You can rename a field in one of the grids
3) Wait until Kendo fixes it :)
4) Maybe someone has another idea?!
I have the following code. i was able to determine the click on a row. but cant get the popup form to open when the row is selected.
@(Html.Kendo().Grid<grid.Model.entity>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.phone).Title("Phone").HeaderHtmlAttributes(new { style = "font-size:13px;" });
columns.Bound(p => p.address).Title("Home Address").HeaderHtmlAttributes(new { style = "font-size:13px;" });
columns.Bound(p => p.email).Title("Email").HeaderHtmlAttributes(new { style = "font-size:13px;" });
})
.ToolBar(toolbar =>
toolbar.Create()
)
.Editable(ed => ed.Mode(GridEditMode.PopUp))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:730px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(30)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.ID))
.Create(update => update.Action("EditingPopup_Create", "Welcome"))
.Read(read => read.Action("Info", "Welcome").Data("searchText"))
.Update(update => update.Action("EditingPopup_Update", "Welcome"))
)
.Resizable(resize => resize.Columns(true))
)
<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);
}
}
$('table').click(function () {
var grid = $("#grid").data('kendoGrid');
grid.select().each(function () {
// how to open the form from here?
})
});
</script>
Hi,
We are using Kendo Data Grid, we are trying to edit the record that will go to a new page (cshtml) and passing a parameter like the ID.
Below is the code but it is not working at all. Please advise, TIA.
index.cshtml
@(Html.Kendo().Grid<iOneDistribution.Web.Models.Users.UserViewModel>()
.Name("grid")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(u => u.UserCode))
.Read(read => read.Action("Users_Read", "Users"))
.Update(update => update.Action("Update", "Users"))
)
.Columns(columns =>
{
columns.Command(c => c.Edit());
columns.Bound(c => c.UserCode);
columns.Bound(c => c.Acronym);
columns.Bound(c => c.IsActive);
columns.Bound(c => c.IsAllowApprove);
columns.Bound(c => c.DefaultCulture);
})
.Pageable()
.Sortable(sortable =>
{
sortable.SortMode(GridSortMode.SingleColumn);
})
.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("_UserEdit"))
.Filterable()
.Scrollable()
)
for the _useredit.cshtml
@model iOneDistribution.Web.Models.Users.UserViewModel
<h3>Customized Person edit template</h3>
<br />
@Html.HiddenFor(model => model.UserCode)
<div>
@Html.LabelFor(model => model.Name)
</div>
<div>
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div>
@Html.LabelFor(model => model.UserGroupCode)
</div>
<div>
@*@Html.Kendo().DateTimePickerFor(model => model.BirthDate)
@Html.ValidationMessageFor(model => model.BirthDate)*@
</div>