Hi
How I can make cascade drop downlist inside a grid like in this example :
https://demos.telerik.com/kendo-ui/grid/editing-custom
Hello
I'm using an editable GRID with CREATE toolbar. I would like to customise my editable pop-up to add a kendoDropDownList for selecting a element in a list.
In my exemple I have a grid with "accessoires" I can ADD new one or DELETE existing ones
If I create I want to choose the new element in a kendoDropDownList NOT in TYPE=INPUT
How to do this ?
Here is the code of my GRID
//Grille des accessoires
$("#gvAccessoires").kendoGrid({
columns: [
{
field: "LibelleObj",
title: "Accessoire"
},
{ command: [{ name: "destroy", text: "Supprimer", visible: function (dataItem) { return !dataItem.IsPublie } }], title: " ", width: "250px" },
],
editable: {
mode: "popup",
window: {
title: "Saisie des accessoires",
width: 600
}
},
toolbar: ["create"],
edit: function (e) {
???? how to add here the kendoDropDownList
},
save: function (e) {
Accessoires.add(new Accessoire(false, e.model));
},
remove: function (e) {
_.forEach(selectedOP.Accessoires, function (item) {
if (item.idObj == e.model.idObj) Accessoires.remove(item);
});
}
});
var ds3 = new kendo.data.DataSource({
data: Accessoires,
schema: {
model: {
id: "idObj",
fields: {
id: { editable: false, nullable: true },
LibelleObj: { validation: { required: true } },
}
}
}
});
$("#gvAccessoires").data("kendoGrid").setDataSource(ds3);
Thank you
Per:
https://demos.telerik.com/aspnet-core/grid
can someone provide/post the source for the Editor Templates Names for Country and ClientCategoryEditor?
I'm trying to make an editable grid with a select control in one of the columns (Country), just like the demo... but the source code/markup seems to be incomplete...
I'm looking for the source editor templates behind these:
columns.Bound(p => p.Country.CountryNameLong).Title("Country").EditorTemplateName("Country")
columns.Bound(p => p.Category.CategoryName).EditorTemplateName("ClientCategoryEditor")
fyi these are broken in the edit in teletik repl as well....
maybe if it was a snake it would have bit me...
Thanks
Hello,
I would like to know if I can add a dropdown list for some cells that users can select instead of plain text.
For example, consider the below demo
https://demos.telerik.com/kendo-ui/spreadsheet/datasource
Can we have some fixed dropdown values to UnitPrice and Discontinued columns to the same example?
Thanks
I use Kendo UI for build my single page web application. My application will add a tab when user click some menu if this menu will not in a tab list. I have a problem with my application when i use app in a period of time, the app gradually slow and slower. I found the reason is because when i add a new tab (with some kendoUI widget), the document will create some sub element in the end of document and i close the tab the widget in tab removed but the sub element will alive so the size of document increase by time used.
Example 1 sub element:
<div class="k-list-container k-popup k-group k-reset" id="pfe6ef2c-9926-45e3-ac6d-8dcb5bb0855b-list" data-role="popup" style="display: none; position: absolute;" aria-hidden="true"><div class="k-group-header" style="display:none"></div><div class="k-list-scroller" unselectable="on"><ul unselectable="on" class="k-list k-reset" tabindex="-1" aria-hidden="true" id="pfe6ef2c-9926-45e3-ac6d-8dcb5bb0855b_listbox" aria-live="off" data-role="staticlist" role="listbox"><li tabindex="-1" role="option" unselectable="on" class="k-item k-state-focused" aria-selected="false" data-offset-index="0" id="dd8303f9-e1d7-4a3a-8e57-fb1478a5d9e0">20</li><li tabindex="-1" role="option" unselectable="on" class="k-item" aria-selected="false" data-offset-index="1">35</li><li tabindex="-1" role="option" unselectable="on" class="k-item" aria-selected="false" data-offset-index="2">50</li><li tabindex="-1" role="option" unselectable="on" class="k-item" aria-selected="false" data-offset-index="3">100</li></ul></div><div class="k-nodata" style="display:none"><div>No data found.</div></div></div>
Is there any solution to when remove the widget from document, the sub element removed too?
Hi,
I am trying to include a dropdownlist in some cells, and a special template for the fields, but that made my ADD-New-Record to stop working in all situations (inline - incell - popup) I tried them all but the button looks like it is not firing when I click it.
So I start searching the whole web to find the problem but could'nt.
endly I figured out that when I keep only one template in my grid then the create button is working fine, but when I have more than one it stops.
Another problem I am facing is, the delete and edit functions work perfectly, but when I try to post to the db it looks fine and I can see in dev-tools a response 200/green, but nothing is saved to the db, and after a lot of tries I just found that when I am choosing any from the drop down on the new record it takes the result as an object, but if I edit a not empty cell from the dropdown list it takes it as a number as supposed.
So may can somebody help me to figure it out?
Here is my script.js:
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
transport: {
read: { url: "fun.php?action=api" },
create: { url: "insert.php?action=insert_channel", type: "POST",
complete: function(e) {$("#grid").data("kendoGrid").dataSource.read(); } },
update: { url: "update.php?action=upd", type: "POST",
complete: function(e) {$("#grid").data("kendoGrid").dataSource.read(); } },
destroy: { url: "destroy.php?action=del_channel",type: "POST",
complete: function(e) {$("#grid").data("kendoGrid").dataSource.read(); } }
},
schema: {
data:"data",
model: {
id:"id",
fields: {
nr: { type:"string", editable:false },
name: { type:"string" , validation : { required : true }},
pic: { type:"string", editable:false, validation : { required : true } },
link: { type:"string", validation : { required : true } },
group: { type:"int", validation : { required : true } },
lang: { type:"int", validation : { required : true } },
status: { type:"int", validation : { required : true } },
up: { type:"string" }
}
}
},
pageSize: 10
},
height:750,
scrollable: true,
sortable: true,
pageable: true,
groupable: {
messages: {
empty: "Drag any column name here to group your channels"
}
},
editable: {
mode: "popup",
update: true,
destroy: true,
confirmation: "Are you sure you want to remove this Channel?" //text for the confirmation message
},
columns: [
{
template: "<center><div class='#: data.class #'>#: nr #</div></center>",
field: "nr",
title: "Nr",
width: 50
},
{
template: "<img width='64' height='64' style='vertical-align:middle; border-radius: 15%;' src='pics/#: data.pic #' alt=''> <span class='#: data.class #'>#: data.pic # </span>",
field: "pic",
title: "pic"
},
{
template: "<div class='#: data.class #'>#: name #</div>",
field: "name",
title: "name",
width: 100
},
{
template: "<div class='#: data.class #'>#: link #",
field: "link",
title:"link",
width:650
},
{
template: "<div class='#: data.class #'>#: group #</div>",
field: "group",
title:"group",
editor:groupEditor
},
{
template: "<div class='#: data.class #'>#: lang #</div>",
field: "lang",
title: "lang",
editor:langEditor
},
{
template: "<div class='#: data.class #'>#: status #</div>",
field: "status",
title: "status",
editor:statusEditor
//template: '#= kendo.toString(BirthDate,"MM/dd/yyyy") #'
},
// adding command in the columns, name - the command name, text - text to be set on the button
{ command: [
{
name: "edit",
text: { // sets the text of the "Edit", "Update" and "Cancel" buttons
edit: "",
update: "Update",
cancel: "Cancel"
}
},
{ name: "destroy", text: "" } // sets the text of the "Delete" button
],
// sets the title and the width of the commands column
title: "Action",
width: "300px"
}
],
toolbar: [
//name - name of the available commands, text - text to be set on the button
{ name: "create", text: "New" },
{ name: "save", text: "Save" },
{ name: "cancel", text: "Cancel" },
{ name: "excel", text: "Export to Excel" }
],
// filter menu settings
filterable: {
name: "FilterMenu",
extra: true, // turns on/off the second filter option
messages: {
info: "Custom header text:", // sets the text on top of the filter menu
filter: "CustomFilter", // sets the text for the "Filter" button
clear: "CustomClear", // sets the text for the "Clear" button
// when filtering boolean numbers
isTrue: "custom is true", // sets the text for "isTrue" radio button
isFalse: "custom is false", // sets the text for "isFalse" radio button
//changes the text of the "And" and "Or" of the filter menu
and: "CustomAnd",
or: "CustomOr"
},
operators: {
//filter menu for "string" type columns
string: {
eq: "Custom Equal to",
neq: "Custom Not equal to",
startswith: "Custom Starts with",
contains: "Custom Contains",
endswith: "Custom Ends with"
},
//filter menu for "number" type columns
number: {
eq: "Custom Equal to",
neq: "Custom Not equal to",
gte: "Custom Is greater than or equal to",
gt: "Custom Is greater than",
lte: "Custom Is less than or equal to",
lt: "Custom Is less than"
},
//filter menu for "date" type columns
date: {
eq: "Custom Equal to",
neq: "Custom Not equal to",
gte: "Custom Is after or equal to",
gt: "Custom Is after",
lte: "Custom Is before or equal to",
lt: "Custom Is before"
}
}
}
});
/* ***********************group**************************** */
function groupEditor(container, options) {
$('<input name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
optionLabel: "Group...",
dataTextField: "group",
dataValueField: "id",
dataSource: {
transport: {
read: { url: "fun.php?action=cat_channels" }
},
schema: {
data: "data",
model: { id: "id",
fields: {group: {editable: false } }
}
},
},
});
}
/* ***********************language**************************** */
function langEditor(container, options) {
$('<input name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
optionLabel: "Language...",
dataTextField: "lang",
dataValueField: "id",
dataSource: {
transport: {
read: { url: "fun.php?action=lang_channels" }
},
schema: {
data: "data",
model: { id: "id",
fields: {lang: {editable: false } }
}
},
},
});
}
/* ***********************status**************************** */
function statusEditor(container, options) {
$('<input name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
optionLabel: "Status...",
dataTextField: "state",
dataValueField: "id",
dataSource: {
transport: {
read: { url: "fun.php?action=state_channels" }
},
schema: {
data: "data",
model: { id: "id",
fields: {state: {editable: false } }
}
},
},
});
}
});
Here is insert.php
<?php include 'config.php'; /* **************************************insert channels*************************** */ function insert_channel() { global $conn; if(isset($_POST['submit'])) { $name =htmlspecialchars($_POST['name'] ?? ''); $pic =htmlspecialchars($_POST['pic'] ?? ''); $link =htmlspecialchars($_POST['link'] ?? ''); $group =htmlspecialchars($_POST['group'] ?? ''); $lang =htmlspecialchars($_POST['lang'] ?? ''); $status =htmlspecialchars($_POST['status'] ?? ''); $sql="INSERT INTO channels ( name, pic, link, cat_id, language_id, status ) VALUES ( '$name', '$pic', '$link', '$group', '$lang', '$status' )"; $query=mysqli_query($conn, $sql); if ($sql) { echo json_encode($sql); } else { header("HTTP/1.1 500 Internal Server Error"); } } } /* -------------------------------switch($_GET['action'])| page.php?action=x ------------------------------------------- */ switch($_GET['action']) { case 'insert_channel': insert_channel(); break; default : echo 'Please check the parameters'; }
Hi Team.
is there a way i can change the styling of the placeholder(optionLabel) text for kendoDropDownList ?
thanks
I'm Already implemented a dropdown in a grid collumn according to this demo: https://demos.telerik.com/kendo-ui/grid/editing-custom
I'm Already did a test with this custom dropdown: https://demos.telerik.com/kendo-ui/dropdownlist/addnewitem
I thinking if its possible to add this custom dropdown in a collumn of the grid to add a new category if the category is not found in the dropdown.
The collumn field doesnt show in the collumn Comment.
I tried the following code without success, some tips of how to solve this?
EDIT 1: I tried a solution from stackoverflow, and I think it is very close to solving this issue(http://dojo.telerik.com/OZIXOlUM). Still, the addNew function expects the widgetID. In the onclick of the add new button, the widgetID is passing nothing (see print screen). How did I get this ID? The script "noDataTemplate" is trying to get the id this way '#:instance.element[0].id#', but as I said, nothing returns.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Vat Grid</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">
<link rel="stylesheet" href="styles/kendo.rtl.min.css">
<link rel="stylesheet" href="styles/kendo.silver.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/estilo.css">
<link rel="stylesheet" href="css/daterangepicker.css">
<script src="js/jquery.min.js"></script>
<script src="js/jszip.min.js"></script>
<script src="js/pako_deflate.min.js"></script>
<script src="js/kendo.all.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div id="grid"></div>
<script id="noDataTemplate" type="text/x-kendo-tmpl">
<div>
No data found. Do you want to add new item - '#: instance.filterInput.val() #' ?
</div>
<br/>
<button class="k-button" onclick="addNew('#: instance.element[0].id #', '#: instance.filterInput.val() #')">Add new item</button>
</script>
<script>
$(document).ready(function(){
var dataSource = new kendo.data.DataSource({
data: categories
});
var gridDataSource = new kendo.data.DataSource({
data : [ {
"Commen": "-",
"Confirmed": 1,
"Stat": 1
},
{
"Commen": "-",
"Confirmed": 1,
"Stat": 1
},
{
"Commen": "-",
"Confirmed": 1,
"Stat": 1
},
{
"Commen": "Some Comment",
"Confirmed": 1,
"Stat": 1
}]
});
$("#grid").kendoGrid({
dataSource: gridDataSource,
height: 550,
groupable: true,
sortable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
columns: [{
field: "Stat",
title: "Status"
}, {
field: "Confirmed",
title: "Confirmed",
template: " <input name='Confirmed' class='Confirmed' type='checkbox' data-bind='checked: Confirmed' #= Confirmed ? checked='checked' : '' #/>"
}, {
field: "Commen",
title: "Comment",
editor: commentCategoryEditor,
template: "#=Commen#",
//template: "<input id='Commen'>",
width: 450,
nullable : true
}]
});
});
var categories = [{
"CategoryName": "-"
},{
"CategoryName": "Category 1"
}, {
"CategoryName": "Category 2"
}];
function commentCategoryEditor(container, options){
$('<input name="Commen">')
.kendoDropDownList({
filter: "startswith",
dataTextField: "CategoryName",
dataValueField: "CategoryID",
dataSource: dataSource,
noDataTemplate: $("#noDataTemplate").html()
});
}
function addNew(widgetId, value) {
var widget = $("#" + widgetId).getKendoDropDownList();
var dataSource = widget.dataSource;
if (confirm("Are you sure?")) {
dataSource.add({
CategoryID: 0,
CategoryName: value
});
dataSource.one("sync", function() {
widget.select(dataSource.view().length - 1);
});
dataSource.sync();
}
};
</script>
</div>
</body>
</html>
I have a dropdownlist with some years. The data source I am using directly an array of numbers eq: [2020, 2021]. I need to remove the 2020. When I am trying to call the method dropdownlist.dataSource.remove(dropdownlist.dataItem()) nothing happens