In one grid i have a dropdownlist editor in one column. When grid load, i see the value but when i edit my row (inline), the value is not selected in dropdownlist. When i click on the arrow dropdownlist expand and close immediatly. What is my problem ?
@* Liste des téléphones *@
var phoneDs = new kendo.data.DataSource({
transport: {
read: {
url: "@Url.Action("ShowPhones", "SupplierInformations")",
method: "post",
dataType: "json"
},
update: {
url: "@Url.Action("UpdatePhone", "SupplierInformations")",
method: "post",
dataType: "json"
},
destroy: {
url: "@Url.Action("DeletePhone", "SupplierInformations")",
method: "post",
dataType: "json"
},
create: {
url: "@Url.Action("AddPhone", "SupplierInformations")",
method: "post",
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
else
{
//return options;
}
}
},
batch: true,
autoSync: true,
schema: {
model: {
id: "PhoneId",
fields: {
PhoneId: { editable: false, nullable: true },
PhoneNumber: { validation: { required: true,
phonevalidation: function (input)
{
if (input.is("[name='PhoneNumber']")) {
input.attr("data-phonevalidation-msg", "@LocalizationValues.The_Phone_Number_Format_Is_Invalid");
return /^@RegexHelper.PhoneRegex^/.test(input.val());
}
return true;
}
} },
PhoneExtension: { validation: { required: false,
extensionvalidation: function (input)
{
if (input.is("[name='PhoneExtension']") && input.val() != "") {
input.attr("data-extensionvalidation-msg", "@LocalizationValues.The_Phone_extension_Is_Invalid");
return /^\d+$/.test(input.val());
}
return true;
}}},
PhoneTypes: { validation: { required: true} },
IsEmergency: { type: "boolean" },
Type: { validation: { required: true,
typevalidation: function (input)
{
if (input.is("[name='Type']")) {
input.attr("data-typevalidation-msg", "@LocalizationValues.The_Phone_Type_Is_Mandatory");
return (input.val() != "");
}
return true;
}
} }
}
}
}
});
$("#phoneGrid").kendoGrid({
dataSource: phoneDs,
pageable: false,
dataBound: function(e){ },
pageSize: 99999,
toolbar: [ {name: "create", text : "@LocalizationValues.Add"}],
columns: [
{ field: "Type", width: "130px", editor: typeDropDownEditor, title: "Type"},
{
field: "PhoneNumber", editor: phoneEditor, title: "PhoneNumber", format: "{0:n}", width: "250px" },
{ field: "PhoneExtension", title:"PhoneExtension", width: "150px", template: '@LocalizationValues.Ext: #: (PhoneExtension == null) ? "" : PhoneExtension#' },
{ command: [{ name : "edit", text: {
edit: "@LocalizationValues.Update",
update: "@LocalizationValues.Confirm",
cancel: "@LocalizationValues.Cancel"
}},
{ name : "destroy", text: "@LocalizationValues.Remove"}], title: " ", width: "250px"}],
editable: {mode : "inline", confirmation: false},
});
function typeDropDownEditor(container, options) {
$('<input name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataTextField: "Text",
dataValueField: "Value",
dataSource: @(New HtmlString(Json.Encode(Model.PhoneTypes)))
});
documentation for router change event says that navigation can be canceled with preventDefault
but i want to ask user before leaving current view if is ok to leave unsaved changes.
can be done using promises ?
Hello,
I have a grid with some cells having a value in multiple lines format. When I tried to export it, the export result set the cell height as a single line.
Is there a way to set the height to auto?
Cheers
I am trying to export a long webpage with many grids and charts to a pdf file with multiple pages. I tried to use the forcePageBreak property but this property breaks the generated pdf. Here is the javascript code of the pdf export:
exportToPdf:function (){
var className = $(this).data('groupname');
$('.'+className).find('.k-grid-excel').hide();
$('.'+className).find('.removeFromReport').hide();
kendo.drawing.drawDOM($("."+className),
{
forcePageBreak: ".page-break",
margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" },
paperSize: "auto",
landscape: true,
multiPage: true }) .then(function(group) {
return kendo.drawing.exportPDF(group, { }); }) .done(function(data) {
kendo.saveAs({
dataURI: data,
fileName: "systemReport.pdf",
proxyURL: "//demos.telerik.com/kendo-ui/service/export" });
$('.'+className).find('.k-grid-excel').show();
$('.'+className).find('.removeFromReport').show();
});
}
I will also attach a zip file with the generated pdf with and without the property forcePageBreak.
Is there any other way to achieve the same functionality.
Many thanks in advance
I'm using the upload widget in via the MVVM framework, and was wondering if there are any options for me to control the text of the "Select files..." button or specify a drop zone via the data-* attributes.
If you have any kind of dojo sample for this I would really appreciate it.
Thanks -
Erik
Hi,
http://dojo.telerik.com/IyoVU/6
In this dojo, I'm trying to mix validation tooltips on simple fields, with custom validation on grid columns. I've used your grid example which validates for the product name beginning with a capital. Run the example, add a row to the grid, enter a product name that is invalid, e.g. "a" and tab off. The product validation tooltip message is not shown, when I think it should be. What am I doing wrong?
Thanks,
Scott
Hello Telerik,
I have a problem with the kendo.saveAs() because the server, where the binary files come from, requires an 'Authorization' in the request headers.
I have been looking for an answer but all I found was that the question was asked before, by somebody else, on StackOverflow: http://stackoverflow.com/questions/41406918/kendo-server-export-post-request-headers
But no useful answer was given so i pop the question here because I do need an answer for this :(
Best regards,
Insad
Hi,
I'm trying to display a partial view in a treelist column
This is the colum definition:
columns.Add().Field(e => e.PageID)
.TemplateId("translation-template")
.HtmlAttributes(new { @class = "center col-lg-2" });
In this codesnippit, the PageID in the first div is displayed correctly for each row in my treelist.
Now I want to use the #: PageID # to be pass into the Html.RenderAction as a parameter (instead of 4)
<
script
id
=
"translation-template"
type
=
"text/x-kendo-template"
>
<
div
>#: PageID #</
div
>
<
div
>
@{Html.RenderAction("_TranslationTemplate",
"Pages",
new { PageID = 4 });
}
</
div
>
</
script
>
Thank you!