Hi guys,
i'm Liuk and i like a lot Kendo's Grid.
But i've a problem with the Hierarchy system, because i can't find a method for open the subgrid only if there is a flag true.
I give an example:
This is th example take from the kendo text
<code>
<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="styles/kendo.common.min.css" /><link rel="stylesheet" href="styles/kendo.default.min.css" /><link rel="stylesheet" href="styles/kendo.default.mobile.min.css" /><script src="js/jquery.min.js"></script><script src="js/kendo.all.min.js"></script></head><body><div id="example"><div id="grid"></div><script> $(document).ready(function() {var element = $("#grid").kendoGrid({ dataSource: { type: "odata", transport: { read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Employees"}, pageSize: 6, serverPaging: true, serverSorting: true}, height: 600, sortable: true, pageable: true, detailInit: detailInit, dataBound: function() {this.expandRow(this.tbody.find("tr.k-master-row").first());}, columns: [{ field: "FirstName", title: "First Name", width: "110px"},{ field: "LastName", title: "Last Name", width: "110px"},{ field: "Country", width: "110px"},{ field: "City", width: "110px"},{ field: "Title"}]});});function detailInit(e) { $("<div/>").appendTo(e.detailCell).kendoGrid({ dataSource: { type: "odata", transport: { read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"}, serverPaging: true, serverSorting: true, serverFiltering: true, pageSize: 10, filter: { field: "EmployeeID", operator: "eq", value: e.data.EmployeeID }}, scrollable: false, sortable: true, pageable: true, columns: [{ field: "OrderID", width: "110px" },{ field: "ShipCountry", title:"Ship Country", width: "110px" },{ field: "ShipAddress", title:"Ship Address" },{ field: "ShipName", title: "Ship Name", width: "300px" }]});}</script></div></body></html>
</code>
for my example i wanna see the sub grid only if the city is "Tacoma", but i can't find a solution online.
Ty for the help guys and i'm sorry for the bad English,
BB Liuk
Hello
I'm using kendoUI multiselect, but have some issues with the event click and destroy.
I'm using Kendo UI v2017.1.118, AngularJS v1.6.4 and jquery-2.2.1
Here is my source code using the MultiSelect:
F
<div ng-controller="icpSinglePersonSelectionController as c" >
<select kendo-multi-select id="selectusers" name="selectusers" k-ng-model="c.uids" k-value-primitive="true"
k-options="c.selectOptions" k-on-change="c.onMultiSelectSelected(kendoEvent)" >
</select>
</div>
app.controller("icpSinglePersonSelectionController",
['$http', '$scope', function
($http, $scope) {
var me = this;
me.uids = [];
me.AllowMultipleSelections= false
me.uid="111111"
me.pname="test"
me.uids = [];
me.value_url ="ContentService/" & uid & "/" & pname
me.possible_value_url = "ContentService/getPossiblePersonValuesForEdit?uid=" &
uid & "&pname=" & pname
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: me.possible_value_url,
}
},
schema: {
data: function (data) {
return angular.fromJson(data);
}
}
});
$http.get(me.value_url).then(function (renspose) {
var jsondata = angular.fromJson(renspose);
var itemData = jsondata[me.pname];
if (angular.isArray(itemData)) {
me.uids = itemData.map(function (item) { return item.uid; });
}
else {
me.uids = [itemData.uid];
}
me.selectOptions = {
dataTextField: "reference_text",
dataValueField: "Id",
footerTemplate: 'Total #: instance.dataSource.total() # items found',
itemTemplate: '<table><tr><td><img class="k-state-default" src="#:data.icon#" height=50px></img></td>' +
'<td><span class="k-state-default"><h3>#: data.reference_text #</h3><p>#: data.department #</p></span></td></tr></table>',
tagTemplate: '<img class="k-state-default" src="#:data.icon#" height=20px></img><span>#:data.reference_text#</span>',
virtual: {
mapValueTo: "dataItem",
valueMapper: function (options) {
$http.post("UserService/getPersons",
{ uids: me.uids }
).then(function (response) {
options.success(response); //return the dataItems that correspond to provided values
});
},
itemHeight: 80
},
dataSource: dataSource,
pageSize: 80,
serverPaging: false,
serverFiltering: true,
height: 520,
value: me.uids,
autoClose: true,
maxSelectedItems: 1,
filter: "contains",
};
});
me.onMultiSelectSelected = function (e) {
var multiselect = e.sender,
amountOfSelectedItems = multiselect.dataItems().length,
maxSelectedItems = multiselect.options.maxSelectedItems;
if (amountOfSelectedItems >= maxSelectedItems) {
$('.k-input').attr('readonly', "readonly");
}
else {
$('.k-input').removeAttr('readonly');
}
};
}]);
Note: When I delete virtualization the events return to work and if I use virtualization without grouping it works.
I have a grid with multi-column headers and there is a group column A which is locked. Here is the code:
$scope.gridOptions.columns = [
{
title: "A", locked: true, headerAttributes: { "class": "section-border" }, groupId : "A",
columns: [{ field: "ROW_HEADER", filterable: false, width: "20px", title: " .", sortable: false, locked: true, headerAttributes: { "class": "sub-col darkYellow-col rowHeaderHeadYellow", "style": "border-right: 0px !important;" }, attributes: { "class": "contert-alpha rowHeaderCell" } },
{ field: "COLUMN1", title: "COLUMN1", width: "80px", hidden: true, locked: true, headerAttributes: { "class": "sub-col darkYellow-col rowHeaderHead2" }, attributes: { "class": "" }, template: "#: COLUMN1)#" },
{ field: "COLUMN2", title: "COLUMN2", width: "150px", locked: true, headerAttributes: { "class": "sub-col darkYellow-col rowHeaderHead2" }, attributes: { "class": "" }, template: #:COLUMN2#}
]
},
{
title: "B", headerAttributes: { "class": "section-border" }, groupId: "B",
columns: [{ field: "COLUMN3", title: "COLUMN3", width: "110px", headerAttributes: { "class": "sub-col continuity" }, attributes: { "class": "contert-alpha center-middle" }, template: "#: COLUMN3 #" },
{ field: "COLUMN4", title: "COLUMN4", width: "120px", headerAttributes: { "class": "sub-col no-left-border" }, attributes: { "class": "contert-number " }, format: "{0: MM/dd/yyyy}" },
}]
}]
I want to unlock the group column A programmatically before printing the grid so that it appears as one grid instead of two. I have set locked=false for COLUMN1, COLUMN2 and group column A before printing but it still stays locked. Then I've set only group column A as unlocked before printing and the group still stays locked. I am using recursive method to unlock them but I but in order to show the gist of this functionality I am doing this to unlock:
thisGrid.unlockColumn(
"A"
);
thisGrid.unlockColumn(
"ROW_HEADER"
);
thisGrid.unlockColumn(
"COLUMN1"
);
thisGrid.unlockColumn(
"COLUMN2"
);
$(
'table#user_org_table'
).data(
'kendoGrid'
).dataSource.filter({});
Hello,
I am using templates with ahref for Kendo toolbar, but the Images dont Show. Only one Show full rest is cut or overlapped i believe
@(Html.Kendo().ToolBar()
.Name("ToolBar")
.Resizable(true)
.Items(items =>
{
items.Add().Template("<a href='javascript: void(0)' class='abutton save' onclick='GoBack()' title='Speichern' > </a>");
items.Add().Template("<a href='javascript: void(0)' class='abutton delete' onclick='onDelete()' title='löschen'> </a>");
items.Add().Template("<a href='javascript: void(0)' class='abutton goback' onclick='GoBack()' title='Zurück zur Liste' > </a>");
})
)
my css
.abutton.save {
background: url('@Url.Content("~/Images/Save_new.png")');
background-repeat: no-repeat;
height:40px;
width:40px;
vertical-align:middle;
}
.abutton.goback {
background: url('@Url.Content("~/Images/arrow_left.png")');
background-repeat: no-repeat;
height:40px;
width:40px;
vertical-align:middle;
}
.abutton.delete {
background: url('@Url.Content("~/Images/delete.png")');
background-repeat: no-repeat;
height:40px;
width:40px;
vertical-align:middle;
}
What am i doing wrong
Thanks
Anamika
I have a kendo Grid with an editor column that uses a combobox whose datasource is set to an object array. Everything works fine except when a user sets enters a custom value into the combobox (for example:'abc') that doesn't match any of the datasource options. The combobox displays undefined when tabbing off of it or moving focus out of the combobox. I have tried to handle this in the change event of the combox box by adding the custom value to the datasource (using the Telerik online example for adding custom values), but that doesn't appear to work.
Below is my html file code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.504/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.504/styles/kendo.material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.504/styles/kendo.material.mobile.min.css" />
<script src="https://kendo.cdn.telerik.com/2017.2.504/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2017.2.504/js/kendo.all.min.js"></script>
</head>
<body>
<div id="mappingGrid"></div>
<script>
//$(document).ready(function () {
//capture vars
var mGrid = $("#mappingGrid").kendoGrid({
dataSource: {
schema: {
model: {
// id: "Id",
fields: {
// Id: { editable: false, nullable: false },
CustomFunction: { defaultValue: { Value: "0", Name: "" } },
}
}
},
},
// batch:true,
pageSize: 10,
autoBind: false,
height: 300,
width: 300,
scrollable: true,
sortable: true,
filterable: true,
editable: true,
// serverFiltering: true,
toolbar: ["create"],
columns: [
{ field: "CustomFunction", title: "Custom Function", editor: customFunctionEditor, template: "#=CustomFunction.Name#" },
{ command: [{ name: "destroy", text: "" }], title: " ", width: "100px" }],
});
function customFunctionEditor(container, options) {
$('<input id="CustomFunction" name="CustomFunction">')
.appendTo(container)
.kendoComboBox({
dataTextField: "Name",
dataValueField: "Value",
change: onComboBoxChange,
// autoBind: abind,
dataSource: [
{ Name: "Add", Value: "1" },
{ Name: "Subtract", Value: "2" },
{ Name: "Multiply", Value: "3" },
{ Name: "Divide", Value: "4" }
],
}).appendTo(container);
}
function DisplayError(xhr) {
var msg = JSON.parse(xhr.responseText);
errornotification("Error", msg.Message);
// alert(msg.Message);
}
function onComboBoxChange(e) {
var combo = e.sender;
var comboText = combo.text();
// check if new value is a custom one
if (!combo.dataItem()) {
var dataSource = combo.dataSource;
dataSource.add({
Value: combo.text(),
Name: combo.text()
});
dataSource.one("sync", function () {
combo.select(dataSource.view().length - 1);
});
dataSource.sync();
}
}
});
</script>
</body>
</html>
Hello,
Can we have tooltip for command Buttons with images
@(Html.Kendo().ToolBar()
.Name("ToolBar")
.Resizable(false)
.Items(items =>
{
items.Add().Type(CommandType.Button).ImageUrl(Url.Content("~/Images/Save_new.png")).Id("saveBtn").Click("SaveEntry");
})
Thanks
Anamika
I have a grid with editable when the cell, I make the with it, but it will close immidiately, it is work with version but not work with 2017.2.504
<
script
>
var ops = [ { Value: "Match", Text: "Match" },
{ Value: "Any", Text: "Any" }];
var operator;
function changeOperator(e, obj, operator){
e.container.find("input[name='oper']").kendoDropDownList({
optionLabel: "Select",
dataTextField: "Text",
dataValueField: "Value",
dataSource: operator
});
}
$("#grid").kendoGrid({
columns: [
{ field: "oper"},
{ field: "val" }
],
dataSource: {
data: [
{ id: 1, oper: "Match", val: 30 },
{ id: 2, oper: "Match", val: 33 }
],
schema: {
model: { id: "id" }
}
},
editable: "incell",
edit: function(e) {
operator = [ops[0], ops[1]];
changeOperator(e, "", operator);
},
});
</
script
>
here is my code in dojo
http://dojo.telerik.com/iguti/2
anyone could tell me why?
thanks a lot.