Hello,
We have a donu chart we draw with the kendo ui vue chart and it looks good. We place it in a small html iframe as you can see in the attached screen shot.
The chart is using 100% of the (small) frame size. As you can see in the attached screen shot, it is not vertically aligned. Since the generated svg occupies 100% of the area I assume it is something in the seriesDefaults to tweak for it to be vertically centered. But I could not find how to do it. Please advise.
Thanks,
Ron.
Hi there,
On tab drag i want to update a field in the datasource. But as soon as datasource sync is called an "Index of undefined" error is received. This is the sortable section of the tabstrip:
var configureSortable = function () {
$("#tabstrip ul.k-tabstrip-items").kendoSortable({
filter: "li.k-item",
axis: "x",
container: "ul.k-tabstrip-items",
hint: function (element) {
return $("<div id='hint' class='k-widget k-header k-tabstrip'><ul class='k-tabstrip-items k-reset'><li class='k-item k-state-active k-tab-on-top'>" + element.html() + "</li></ul></div>");
},
start: function (e) {
tabstrip.activateTab(e.item);
},
change: function (e) {
var tabstrip = $("#tabstrip").data("kendoTabStrip"),
reference = tabstrip.tabGroup.children().eq(e.newIndex);
if (e.oldIndex < e.newIndex) {
tabstrip.insertAfter(e.item, reference);
} else {
tabstrip.insertBefore(e.item, reference);
}
},
move: function(e) {
//NOTE: the heading element will be excluded from the
//collection as it does not match the filter
//e.preventDefault();
//shows the original position of the item
var originalPos = this.indexOf(e.item);
console.log("index of item", originalPos);
//shows the position where item will be moved to
var newPos = this.indexOf(this.placeholder);
console.log("index of placeholder", newPos);
//var item = tabStrip.dataSource.at(originalPos);
//console.log(item.id + item.pos + item.name + item.status + newPos);
//item.set("pos", newPos);
//tabStrip.dataSource.sync();
var tabstrip = $("#tabstrip").data("kendoTabStrip");
//this gives me a null
//var dataItem = tabstrip.dataSource.get(e.item.data("id"));
var dataItem = tabstrip.dataSource.at(originalPos);
//i tried this as well
//tabstrip.dataSource.remove(dataItem);
//tabstrip.dataSource.insert(newPos, dataItem);
dataItem.set("pos", newPos);
tabstrip.dataSource.sync();
}
});
};
I am seeing VERY strange behavior using a kendoValidtor with a listView. The listview is a table and each line looks like this:
<
script
type
=
"text/x-kendo-tmpl"
id
=
"tmplMenuOptionsGroupRow"
>
<
tr
>
<
td
class
=
"w-25"
>
<
i
class
=
"fal fa-arrows fa-2x dragHandler"
></
i
>
</
td
>
<
td
class
=
"w-50"
>
<
input
name
=
"optionDesc"
class
=
"form-control k-textbox k-input-lg"
required
validationMessage
=
"Enter Description"
data-bind
=
"value: description, disabled:legacy, events:{change: editorModel.menuOptionGroup.onMenuItemOptionsGroupChange}"
/>
</
td
>
<
td
class
=
"w-25 dragHide text-left"
>
<
input
class
=
"w-100 k-input-lg"
data-role
=
"numerictextbox"
data-format
=
"c"
data-min
=
"0"
data-format
=
"c2"
name
=
"optionPrice"
data-spinners
=
false
required
validationMessage
=
"Enter Price"
data-bind
=
"value:price, disabled:legacy, events:{change: editorModel.menuOptionGroup.onMenuItemOptionsGroupChange}"
/>
<
span
class
=
"k-invalid-msg"
data-for
=
"optionPrice"
></
span
>
</
td
>
<
td
class
=
"dragHide"
>
<
button
type
=
"button"
class
=
"btn btn-danger btn-sm"
data-bind
=
"click:editorModel.menuOptionGroup.deleteOption, disabled:legacy"
><
i
class
=
"fal fal fa-trash-alt"
></
i
>
</
button
>
</
td
>
</
tr
>
</
script
>
As you can see the optionDesc field is a mandatory field and I have defined a validationMessage when it is empty.
However when I test it I see the following results (see 2020-03-29_1045.png)
As you can see the error message appears nexts ALL the optionDesc fields and not just the one that is missing.
So I thought I would try a different approach with the optionPrice field (also required). so I added a k-invalid-msg right next to the field in the same <tr> and <td >as the input.
However it also behaves incorrectly and even MORE strangely. Basically the error message is displayed in the correct spot the first time. After that if any other field in another row is blank the error message is displayed in the original place and NOT next to the empty field. See image 2020-03-29_1049.png as an example. The field in row 3 is missing but the error message is showing in row 1 where it was previously missing.
Anyone have ideas/suggestions?
Alon
Is there a configuration setting or sample code for entering currency amounts in ATM style ?
For example
key
press display
1 $ .1
2 $ .12
3 $ 3.12
5 $ 53.12
1 $ 153.12
2 $ 2,153.12
1 $ 12,153.12
etc...
Hi,
The TypeScript definitions for the View are incomplete.
Kind Regards,
Marco
var AuctionGrid = {};
/// class variables
AuctionGrid._id = null;
AuctionGrid._auctionDataSource = null;
/// <
summary
>Initialize the auctions grid</
summary
>
AuctionGrid.init = function () {
// Auction Datasource
AuctionGrid._auctionDataSource = new kendo.data.DataSource({
transport: {
read: {
url: _rootUrl + "Test/GetAuctions/"
},
update: {
url: _rootUrl + "Test/UpdateAuctions/",
type: "POST"
},
destroy: {
url: _rootUrl + "Test/DestroyAuction/",
type: "POST"
},
create: {
url: _rootUrl + "Test/CreateAuction/",
type: "POST"
},
parameterMap: function (data, type) {
// If update, create or destroy, then serialize the data
// as JSON so that it can be more easily read on the server.
if (type != "read") {
return { models: JSON.stringify(data.models) };
} else {
return data;
}
}
},
schema: {
model: {
id: "AuctionID",
fields: {
AuctionID: {
editable: false,
type: "number"
},
AuctionName: {
type: "string",
validation: {
required: { message: "An Auction Name is Required!" },
validateAuctionName: function (input) {
//alert(input.attr("data-bind"));
if (input.attr("data-bind") == "value:AuctionName") { // check if this is the element to validate
alert(input.val().length);
if (input.val().length > 10) {
input.attr("data-validateAuctionName-msg", "AuctionName can only have a maximum of 10 characters.");
return false;
}
else
return true;
}
return true;
}
}
},
ShortDescription: {
type: "string"
},
LongDescription: {
type: "string"
},
StartDate: {
type: "date"
},
EndDate: {
type: "date",
validation: {
required: { message: "End Date is Required!" },
validateEndDate: function (input) {
HOW DO I USE VALIDATION HERE - HOW DO I VALIDATE THAT END DATE > START DATE
}
}
},
Active: { type: "boolean" }
}
}
}
});
// Display the active auctions in a kendo grid.
$("#AuctionGrid").kendoGrid({
dataSource: AuctionGrid._auctionDataSource,
scrollable: true,
editable: "popup",
pageSize: 6,
edit: onEdit,
height: 300,
toolbar: ["create"],
columns: [{
field: "AuctionName",
title: "Auction Name",
width: "200px"
}, {
field: "ShortDescription",
title: "Description",
editor: textareaEditor
}, {
field: "StartDate",
title: "Start Date",
format: "{0:MM-dd-yyyy hh:mm tt}",
editor: dateTimeEditor,
width: "100px"
}, {
field: "EndDate",
title: "End Date",
format: "{0:MM-dd-yyyy hh:mm tt}",
editor: dateTimeEditor,
width: "100px"
}, {
field: "Active",
title: "Active",
template: "<
input
type=\"checkbox\" />",
width: "80px"
}, {
command: ["edit", "destroy"], title: " ", width: "110px"
}],
groupable: false
});
}
function onEdit(e) {
$(e.container).parent().css({
width: '600px',
height: '400px'
});
// set maxLengths
e.container.find("input[name=AuctionName]").attr("maxlength", 10);
}
function dateTimeEditor(container, options) {
$('<
input
data-text-field
=
"' + options.field + '"
data-value-field
=
"' + options.field + '"
data-bind
=
"value:' + options.field + '"
data-format
=
"' + options.format + '"
/>')
.appendTo(container)
.kendoDateTimePicker({});
}
function textareaEditor(container, options) {
$('<
textarea
data-bind
=
"value:' + options.field + '"
style
=
"width:400px;"
rows
=
"4"
></
textarea
>')
.appendTo(container);
}
Hello,
First let me start by saying thanks for your previous help on these forums...they got me past a blocking issue and everything is working now...so there's the good news.
The bad news is that even though everything is working...there are some visual glitches that I can't figure out. The worst of those being whenever I add a new row into my grid...on this particular example I have 2 DropDownLists for selecting the values to add in for the new row. They function perfectly, but once I select a value and move onto the next column...the DropDownList and the selected value for it disappears...the value is still there in the new row, because when I click Save and look at the Controller Action, everything is coming across perfectly and the data is added into the database with no problems...also after I click save...the columns show the values as they should...the DropDownLists are disappearing only when adding a new row. I've attached some pictures for reference and I'll include code snippets for my grid and dropdownlist.
In the attached pictures...notice that the columns have the little red triangle in the upper left to note that there's a new value contained...but how when I move onto the next column the DropDownList and it's selected value are hidden...
Grid View:
@using TPOReporting
@{
ViewBag.Title = "Server Switch Feature Defect Maintenance";
Layout = null;
}
<
script
>
function grid_error(e)
{
if (e.errors)
{
var message = "There are some errors:\n";
// Create a message containing all errors.
$.each(e.errors, function (key, value)
{
if ('errors' in value)
{
$.each(value.errors, function ()
{
message += this + "\n";
});
}
});
// Display the message
alert(message);
// Cancel the changes
var grid = $("#ServerSwitchFeatureDefectGrid").data("kendoGrid");
grid.cancelChanges();
}
}
</
script
>
<
div
>
<
h2
>Server Switch Feature Defects</
h2
>
<
hr
size
=
"3"
/>
</
div
>
<
div
>
@(Html.Kendo().Grid<
ServerSwitchFeatureDefectModel
>()
.Columns(c =>
{
c.Bound(ssfd => ssfd.FeatureDefectID)
.ClientTemplate("#:FeatureDefectName#")
.EditorTemplateName("FeatureDefectDropDownListTemplate")
.Title("Feature Defect");
c.Bound(ssfd => ssfd.ServerSwitchTestStatusID)
.ClientTemplate("#:ServerSwitchTestStatusName#")
.EditorTemplateName("ServerSwitchTestStatusDropDownListTemplate")
.Title("Server Switch Test Status");
c.Bound(ssfd => ssfd.BugID)
.Title("Bug ID");
c.Bound(ssfd => ssfd.LastUpdate)
.Title("Last Update");
c.Command(cmd =>
{
cmd.Destroy();
});
})
.DataSource(ds => ds
.Ajax()
.Create(c => c.Action("AddServerSwitchFeatureDefect", "ServerSwitchFeatureDefect"))
.Destroy(d => d.Action("RemoveServerSwitchFeatureDefect", "ServerSwitchFeatureDefect"))
.Events(e => e.Error("grid_error"))
.Model(m =>
{
m.Id(s => s.ID);
m.Field(s => s.ID).Editable(false);
})
.Read(r => r.Action("GetServerSwitchFeatureDefects", "ServerSwitchFeatureDefect"))
.Update(u => u.Action("UpdateServerSwitchFeatureDefect", "ServerSwitchFeatureDefect")))
.Editable(e => e.Mode(GridEditMode.InCell))
.HtmlAttributes(new { style = "height:300px;" })
.Name("ServerSwitchFeatureDefectGrid")
.Scrollable()
.Selectable()
.Sortable()
.ToolBar(t =>
{
t.Create();
t.Save();
}))
</
div
>
FeatureDefectDropDownListTemplate:
@using TPOReporting
@(Html.Kendo().DropDownListFor(m => m)
.DataSource(ds =>
{
ds.Custom()
.Type("aspnetmvc-ajax")
.Transport(t =>
{
t.Read("GetFeatureDefects", "FeatureDefect");
})
.Schema(s =>
{
s.Data("Data")
.Total("Total");
});
})
.DataTextField("Name")
.DataValueField("ID")
.Name("FeatureDefectID")
.OptionLabel("Select Feature Defect..."))
ServerSwitchTestStatusDropDownListTemplate:
@using TPOReporting
@(Html.Kendo().DropDownListFor(m => m)
.DataSource(ds =>
{
ds.Custom()
.Type("aspnetmvc-ajax")
.Transport(t =>
{
t.Read("GetServerSwitchTestStatus", "ServerSwitchTestStatus");
})
.Schema(s =>
{
s.Data("Data")
.Total("Total");
});
})
.DataTextField("DisplayName")
.DataValueField("ID")
.Name("ServerSwitchTestStatusID")
.OptionLabel("Select Server Switch Test Status..."))
The controllers are all working perfectly so I don't think I need to include those source files, but I will gladly do it if requested. They all pass back Model objects as Json via ActionResults. Pretty standard stuff.
I have a grid with 5 columns, 4 of which are set to autoFitColumn. When in the normal view, they are behaving as expected - resizing to fit the needs of the text contained in them.
When I export the view to a PDF though, it is completely minimizing the autofit columns down to a tiny size. When I apply the autoFitColumn to the grid as a whole, the columns are not necessarily auto-fitting, instead having parts of text cut off on the longer columns, while leaving the other smaller columns with a bunch of white space.
Attached image shows what I'm trying to say here. What I'm trying to get is those 4 columns to be autoFit and still show up properly when exported to PDF. OR for the "all columns autofit" to stop giving all the whitespace to the small columns so that it isn't cutting off the text of the larger ones.
Thanks