I have a grid where I have inline editing. The first column has a dropdown editor. On the change event of the dropdown editor I want to update the second column with a default value from the selected option in column 1.
A row has represents an equipment model.
Name, Unit, Price.
When I select the Name (dropdown) I want to update the Unit and Price with default values.
My editor is:
function EquipmentModelDropDownEditor(container, options) {
$('<input required data-text-field="FriendlyName" data-value-field="EquipmentModelId" data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
dataTextField: "FriendlyName",
dataValueField: "EquipmentModelId",
autoBind: true,
dataSource: new kendo.data.DataSource({
schema: {
model: {
id: "EquipmentModelId"
}
},
transport: {
read: {
url: "/CostSheet/GetEquipomentModelsByCategory",
dataType: "json",
data: {
catId: options.model.CostSheetCategoryId
}
}
}
}),
optionLabel: "--Select Value--",
change: function (e) {
var equipmentModel = this.dataItem(e.item);
options.model.Unit = equipmentModel.DefaultUnit;
options.model.Price = equipmentModel.DefaultPrice;
alert(equipmentModel.DefaultUnit);
}
});
}
My grid is:
$("#@gridName").kendoGrid({
dataSource: new kendo.data.DataSource({
schema: {
model: {
id: "CostSheetDetailId",
fields: {
CostSheetDetailId: { editable: false },
FriendlyName: { nullable: false, type: "string", defaultValue: "" },
EquipmentModelId: { editable: true, nullable: false},
Unit: { type: "number" },
Price: { type: "number" },
Budget: { type: "number", editable: false },
Actual: { type: "number" },
CostSheetCategoryId: {nullable: false, type: "number", defaultValue: @Model.Category.CostSheetCategoryId}
}
}
},
transport: {
read: {
url: "/CostSheet/CostSheetCategoryDetailGet",
dataType: "json",
data: {
Id: @Model.CostSheetId,
CostSheetCategoryId: "@Model.Category.CostSheetCategoryId",
IsFixed: "@Model.Category.IsFixed"
}
},
create: {
url: "/CostSheet/CostSheetCategoryDetailCreate",
dataType: "json",
type: "POST",
data: {
__RequestVerificationToken: getAntiForgeryToken()
}
},
update: {
url: "/CostSheet/CostSheetCategoryDetailEdit",
dataType: "json",
type: "POST",
data: {
__RequestVerificationToken: getAntiForgeryToken()
}
},
destroy: {
url: "/CostSheet/CostSheetCategoryDetailDelete",
dataType: "json",
type: "POST",
data: {
__RequestVerificationToken: getAntiForgeryToken()
}
}
}
}),
toolbar: ["create"],
sortable: true,
columns: [
{ field: "EquipmentModelId", title: "Name", template: "#=FriendlyName#", editor: EquipmentModelDropDownEditor },
{ field: "Unit", title: "Unit", width: "180px" },
{ field: "Price", title: "Price", width: "180px" },
{ field: "Budget", title: "Budget", width: "180px" },
{ field: "Actual", title: "Actual", widht: "180px" },
{ command: ["edit", "destroy"], title: " ", width: "211px" }
],
editable: "inline"
});
So. when I select from a dropdown I want to update the editor for the Unit and Price to reflect the default prices. The backend model seems to be updated however the editor itself doesn't reflect the change.
Hello, I found a bug with the rendering if the switch. It renders off by exactly one pixel.
Please see the attached image. The top switch has the fix in place, the bottom one does not. You'll notice the underside shows one pixel column on the right.
The javascript was rendering the km-switch-handle class with an inline transformX, for 37px. It needs to be 38px to cover up the underside of the switch fully.
To fix this, I edited kendo.all.min.js. I replaced this line:
function(e){var t=this;t.position=e,t.handle.css(f,"translatex("+e+"px)"),t._animateBackground&&t.background.css(d,t.origin+e)}
with this line:
function(e){var t=this;t.position=e,t.handle.css(f,"translatex("+(e+1)+"px)"),t._animateBackground&&t.background.css(d,t.origin+e)}
However, while this fixed it when the switch was in the "on" state, it now has broken it by one pixel when the switch is in the "off" switch (see second attachment). Is there a permanent fix I can implement?
Thanks!!
-Chris
P.S. the only modifications I made to the default moonlight css is to change the on/off colors. Everything else is unchanged.
I have the following:
@(Html.Kendo().DropDownListFor(model => model.RecurringTypeID)
.SelectedIndex(0) //Select 1st item.
.DataTextField("Text")
.DataValueField("Value")
.BindTo(Model.RecurringType)
.HtmlAttributes(new { style = "font-size:11px;width: 175px;" })
.Events(e =>
{
e.Change("OnChangeRecurringType");
})
)
Why .SelectedIndex(0), .SelectedIndex(1), or .SelectedIndex(2) always return the 1st value on the dropdownlist.
Hi All,
How would I achieve the following in Kendo Grid? I have the following data return from a json call.
[Data]
- Id (1)
- Name (Test)
[SubData] : Array[3]
0: Object
- NumberX (999)
- NumberY (888)
1: Object
- NumberX (123)
- NumberY (456)
2: Object
- NumberX (789)
- NumberY (222)
and I would like to display them in the following
Id Name NumberX Number Y
1 Test 999 888
1 Test 123 456
1 Test 789 222
A sample would be appreciated.
TIA
I'm trying to bind the nested object data to the grid control. Data binding is working fine. But I'm facing problem in filtering row.
In the filter, the controls are not loading/binding based on the field type.
E.g.
From the below code snippet. I'm binding data and applying filter row for the same. But I'm not getting the data-picker as we have it in the demo. Attached the screenshot for your reference.
JSON:var reportSummary = [{ "schedule": { "id": 47, "name": " Schedule12", "description": "Blasting", "startDate": "2015-03-14", "endDate": "2015-03-17" }, "frequency": { "id": 19, "scheduleId": 47, "frequency": "Daily", "interval": 1 }, { "schedule": { "id": 45, "name": " Schedule15", "description": "Test", "startDate": "2015-03-15", "endDate": "2015-03-20" }, "frequency": { "id": 19, "scheduleId": 45, "frequency": "Monthly", "interval": 1 } }] Script:$(document).ready(function () { $("#grid").kendoGrid({ dataSource: { data: reportSummary, schema: { model: { fields: { schedule: { name: {type: "string"}, description: {type: "string"}, startDate: {type: "date"} } } } }, pageSize: 20 }, height: 550, scrollable: true, sortable: true, filterable: { mode: "row" }, pageable: { input: true, numeric: false }, columns: [ {field: "schedule.name", title: "Name", format: "{0:c}", width: "130px"}, {field: "schedule.description", title: "Description", width: "130px"}, {field: "schedule.startDate", title: "Start Date", width: "130px"} ] }); });Appreciate your support on this issue.
Hello,
in my grid I activated the column menu feature (http://demos.telerik.com/kendo-ui/grid/column-menu). But I have some hidden fields which I not want to be shown in the "Columns" menu item. So, is it possible to restrict the items listed under the "Columns" menu item?
Regards
Sebastian
Hello,
I made a grid with basic filtering on it and when adding 'kendo.all.min.js' to my html, all works fine but as soon as I try to add only partial files it crashes. I'll attach the js files I have added in case I'm missing something:
'vendor/kendo-ui/js/kendo.core.min.js',
'vendor/kendo-ui/js/kendo.angular.min.js',
'vendor/kendo-ui/js/kendo.calendar.min.js',
'vendor/kendo-ui/js/kendo.popup.min.js',
'vendor/kendo-ui/js/kendo.datepicker.min.js',
'vendor/kendo-ui/js/kendo.userevents.min.js',
'vendor/kendo-ui/js/kendo.numerictextbox.min.js',
'vendor/kendo-ui/js/kendo.data.min.js',
'vendor/kendo-ui/js/kendo.list.min.js',
'vendor/kendo-ui/js/kendo.dropdownlist.min.js',
'vendor/kendo-ui/js/kendo.filtermenu.min.js',
'vendor/kendo-ui/js/kendo.menu.min.js',
'vendor/kendo-ui/js/kendo.columnmenu.min.js',
'vendor/kendo-ui/js/kendo.pager.min.js',
'vendor/kendo-ui/js/kendo.selectable.min.js',
'vendor/kendo-ui/js/kendo.draganddrop.min.js',
'vendor/kendo-ui/js/kendo.reorderable.min.js',
'vendor/kendo-ui/js/kendo.resizable.min.js',
'vendor/kendo-ui/js/kendo.ooxml.min.js',
'vendor/kendo-ui/js/kendo.excel.min.js',
'vendor/kendo-ui/js/kendo.columnsorter.min.js',
'vendor/kendo-ui/js/kendo.grid.min.js'