In a previous post on here, I wrote about implementing drag and drop and sorting on 2 listviews. I've been able to resolve that issue.
The issue I'm having now is, I need to update the listview after the items have been reordered. I have sub items under the items that are getting dragged over. When I reorder the items, it messes up the appearance. See the attached images.
Here are my template for the items:
<script id="selected-item-template" type="text/x-kendo-template">
<div class="item">
<div style="float: right;"><i class="fas fa-fw fa-trash" onclick="removeSelected('${Id}')"></i></div>${Name}
</div>
#= renderMySlideTemplates(data) #
</script>
<script id="sub-item-my-template" type="text/x-kendo-template">
# $.each(data.PDFSlides, function(index, item){
#
<div class="sub-item">
<input type="checkbox" name="cbxSlideSelection" value="${item.Id} " /> ${item.Title}
</div> #
});
#
</script>
Does anyone have any suggestions?
Hi,
I'm using popup editing mode for my grid model and there is one checkbox which is required. I'm encountering an issue that the checkbox doesn't seem to be validated on blur. After I checked the box, the validation message is not getting removed. Other text fields and drop down fields are working fine. How would I resolve this issue?
Hi,
My code :
<
div
id
=
"diagram"
></
div
>
<
script
>
var dataSource = new kendo.data.HierarchicalDataSource({
data: [{
"name": "Progress",
"items": [
{"name": "Kendo UI",
"items":[
{"name": "TreeList"},
{"name": "Chart"}
]
},
{"name": "NativeScript"}
]
}],
schema: {
model: {
children: "items"
}
}
});
$("#diagram").kendoDiagram({
dataSource: dataSource,
editable : {
tools : [
{ name : "createShape" }
]
},
layout: {
type: "tree",
subtype: "down"
},
shapeDefaults: {
type: "circle",
content: {
template: "#= name #"
},
width: 80,
height: 80,
hover: {
fill: "Orange"
}
},
connectionDefaults: {
stroke: {
color: "#979797",
width: 1
},
type: "polyline",
startCap: "FilledCircle",
endCap: "ArrowEnd"
}
});
When you press add, you can see the error details from the console, how can I solve it?
app.js:35020 Uncaught TypeError: Cannot set property 'element' of undefined
at init.createShape (app.js:35020)
at init.createShape (app.js:35022)
at init.click (app.js:35022)
at init.proxy (app.js:34131)
at init.trigger (app.js:34387)
at init._buttonClick (app.js:34690)
at init.proxy (app.js:34131)
at init.trigger (app.js:34387)
at init._click (app.js:34454)
at HTMLAnchorElement.arguments.length.arguments.<computed>.indexOf.t.<computed>.t.<computed>.options.t.<computed> (app.js:34388)
createShape @ app.js:35020
createShape @ app.js:35022
click @ app.js:35022
proxy @ app.js:34131
trigger @ app.js:34387
_buttonClick @ app.js:34690
proxy @ app.js:34131
trigger @ app.js:34387
_click @ app.js:34454
arguments.length.arguments.<computed>.indexOf.t.<computed>.t.<computed>.options.t.<computed> @ app.js:34388
dispatch @ app.js:28789
elemData.handle @ app.js:28593
I am trying to achieve a layout in which all of the columns and data are stacked in one line. The data for the columns is dynamic, and each column will not have the same sets of data. Attached is a picture of the layout I am trying to achieve. Please have a look.
I've looked into the groupable functionality to achieve this, but I am still not very sure so any guidance would be greatly appreciated. Thank you so much.
I would like to increase the width of the Field selection DropDownList. When the list drops down, it is expanded enough to show all of the long field names (that is good!), but I would like to also increase the width of the control so that when a long field is selected it will show the whole name. How can I do that?
Thanks!
I have an application that has 2 ListViews. I have one ListView that lists products and I'm able to drag the products over to the other ListView. I'm able to drag over the items. The issue that I'm running into is when I try to resort the items on the second ListView. The application breaks. I'm not sure how to fix this.
I've copied over some of my code to see if someone can spot the issue
$("#products-list").kendoListView({
selectable: "single",
dataSource: productsList,
template: kendo.template($('#item-template').html())
});
$("#products-list").kendoDraggable({
filter: ".item",
hint: function (element) {
return element.clone();
},
kendoDropTarget: "#selected-products-list",
});
$("#selected-products-list").kendoListView({
dataSource: selectedProducts,
template: kendo.template($('#selected-item-template').html())
});
$("#selected-products-list").kendoDropTarget({
drop: function (e) { // Apply the changes to the data after an item is dropped.
var draggableElement = e.draggable.currentTarget,
dataItem = productsList.getByUid(draggableElement.data("uid")); // Find the corresponding dataItem by uid.
selectedProducts.add(dataItem);
}
});
$("#selected-products-list").kendoSortable({
filter: ".item",
cursor: "move",
placeholder: function (element) {
return element.clone().css("opacity", 0.1);
},
hint: function (element) {
return element.clone().removeClass("k-state-selected");
},
change: function (e) {
var oldIndex = e.oldIndex,
newIndex = e.newIndex,
data = selectedProducts.data(),
dataItem = selectedProducts.getByUid(e.item.data("uid"));
selectedProducts.remove(dataItem);
selectedProducts.insert(newIndex, dataItem);
}
});
I have seen multiple articles about clearing a date picker but they don't work. Multiple posts say this should do it:
jQuery("#datepicker").data("kendoDatePicker").value(null);
This clears the display, but it does not show the placeholder text that's there before a value is selected. I would expect that to happen automatically when the value is set to null, but since it doesn't, how do I make that happen?
001.
var
dataSource =
new
kendo.data.DataSource({
002.
batch:
false
,
003.
autoSync:
true
,
004.
transport: {
005.
read: {
006.
url:
"/monitoring/matrix/routecontentrules?format=json"
,
007.
contentType:
"application/json; charset=utf-8"
,
008.
dataType:
"json"
,
009.
type:
"POST"
,
010.
timeout: 30000
011.
},
012.
update: {
013.
url:
"/monitoring/matrix/routecontentrules/updateroutecontentrule"
,
014.
contentType:
"application/json; charset=utf-8"
,
015.
dataType:
"json"
,
016.
type:
"PUT"
017.
},
018.
create: {
019.
url:
"/monitoring/matrix/routecontentrules/createroutecontentrule"
,
020.
contentType:
"application/json; charset=utf-8"
,
021.
dataType:
"json"
,
022.
type:
"POST"
023.
},
024.
destroy: {
025.
url:
"/monitoring/matrix/routecontentrules/deleteroutecontentrule"
,
026.
contentType:
"application/json; charset=utf-8"
,
027.
dataType:
"json"
,
028.
type:
"DELETE"
029.
},
030.
parameterMap:
function
(data, operation) {
031.
if
(operation ==
"read"
) {
032.
return
kendo.stringify({
033.
RouteId: routeDataItem.RouteId
034.
});
035.
}
036.
else
if
(operation ==
"destroy"
) {
037.
return
kendo.stringify({
038.
Id: data.Id,
039.
});
040.
}
041.
else
{
042.
return
kendo.stringify({
043.
Id: data.Id,
044.
RouteId: routeDataItem.RouteId,
045.
OrderId: data.OrderId,
046.
SenderMatch: data.SenderMatch,
047.
ContentMatch: data.ContentMatch,
048.
SenderReplace: data.SenderReplace,
049.
ContentReplace: data.ContentReplace,
050.
});
051.
}
052.
}
053.
},
054.
schema: {
055.
model: {
056.
id:
"Id"
,
057.
fields: {
058.
Id: { type:
"number"
, defaultValue: 0 },
059.
OrderId: { type:
"number"
, defaultValue: 0 },
060.
SenderMatch: { type:
"string"
, defaultValue:
""
},
061.
ContentMatch: { type:
"string"
, defaultValue:
""
},
062.
SenderReplace: { type:
"string"
, defaultValue:
""
},
063.
ContentReplace: { type:
"string"
, defaultValue:
""
}
064.
}
065.
}
066.
}
067.
});
068.
069.
$(
"#Grid"
).kendoGrid({
070.
dataSource: dataSource,
071.
reorderable:
false
,
072.
resizable:
false
,
073.
sortable:
false
,
074.
groupable:
false
,
075.
scrollable:
true
,
076.
navigatable:
true
,
077.
editable:
true
,
078.
columns: [
079.
{
080.
width: 150, field:
"SenderMatch"
, title:
"Sender match"
,
081.
template:
"<span><label class='SenderMatch'</label></span>"
,
082.
headerAttributes: { title:
"Sender match"
, style:
"text-align: right"
}, attributes: { style:
"text-align: right"
}
083.
},
084.
{
085.
width: 150, field:
"ContentMatch"
, title:
"Content match"
,
086.
template:
"<span><label class='SenderMatch'</label></span>"
,
087.
headerAttributes: { title:
"Content match"
, style:
"text-align: right"
}, attributes: { style:
"text-align: right"
}
088.
},
089.
{
090.
width: 150, field:
"SenderReplace"
, title:
"Sender replace"
,
091.
template:
"<span><label class='SenderMatch'</label></span>"
,
092.
headerAttributes: { title:
"Sender replace"
, style:
"text-align: right"
}, attributes: { style:
"text-align: right"
}
093.
},
094.
{
095.
width: 150, field:
"ContentReplace"
, title:
"Content replace"
,
096.
template:
"<span><label class='SenderMatch'</label></span>"
,
097.
headerAttributes: { title:
"Content replace"
, style:
"text-align: right"
}, attributes: { style:
"text-align: right"
}
098.
},
099.
{
100.
command: [
101.
{ name:
"destroy"
, template:
"<a class='k-button k-grid-delete delete'><span class='k-sprite px-sprite px-i-sm-trash'></span></a>"
}
102.
],
103.
width:
"50px"
104.
}
105.
],
106.
toolbar: kendo.template(
'<span class="ReloadManipulationByCustomer" style=""><span class="k-icon k-i-refresh refresh-btn"></span></span><a class="k-button k-grid-add add-btn" href="javascript:void(0)"><span class="k-sprite px-sprite px-i-sm-new new" />Add</a>'
)
107.
});
108.
109.
$(
".ReloadManipulationByCustomer"
).click(
function
() {
110.
$(
"#Grid"
).data(
"kendoGrid"
).dataSource.read();
111.
});
For backend I am using ServiceStack, requests are define as followed:
01.
[Route(
"/monitoring/matrix/routecontentrules/createroutecontentrule"
,
"POST"
)]
02.
[Route(
"/monitoring/matrix/routecontentrules/updateroutecontentrule"
,
"PUT"
)]
03.
public
sealed
class
CreateUpdateRouteContentRuleRequest
04.
{
05.
public
int
Id {
get
;
set
; }
06.
07.
public
int
OrderId {
get
;
set
; }
08.
09.
public
int
RouteId {
get
;
set
; }
10.
11.
public
string
SenderMatch {
get
;
set
; }
12.
13.
public
string
ContentMatch {
get
;
set
; }
14.
15.
public
string
SenderReplace {
get
;
set
; }
16.
17.
public
string
ContentReplace {
get
;
set
; }
18.
}
19.
20.
[Route(
"/monitoring/matrix/routecontentrules"
)]
21.
public
sealed
class
RouteContentRulesRequest
22.
{
23.
public
int
RouteId {
get
;
set
; }
24.
}
25.
26.
[Route(
"/monitoring/matrix/routecontentrules/deleteroutecontentrule"
)]
27.
public
sealed
class
DeleteRouteContentRuleRequest
28.
{
29.
public
int
Id {
get
;
set
; }
30.
}
31.
32.
public
sealed
class
RouteContentRuleModel
33.
{
34.
public
int
Id {
get
;
set
; }
35.
36.
public
int
OrderId {
get
;
set
; }
37.
38.
public
int
RouteId {
get
;
set
; }
39.
40.
public
string
SenderMatch {
get
;
set
; }
41.
42.
public
string
ContentMatch {
get
;
set
; }
43.
44.
public
string
SenderReplace {
get
;
set
; }
45.
46.
public
string
ContentReplace {
get
;
set
; }
47.
}
Code for retrieving data is as follows:
01.
public
object
Post(RouteContentRulesRequest request)
02.
{
03.
return
_dbConnectionFactory
04.
.OpenReadOnlyAndRun(dbConn => dbConn.Select<RouteContentRule>(r => r.RouteId == request.RouteId).OrderBy(r => r.OrderId));
05.
}
06.
07.
public
object
Any(CreateUpdateRouteContentRuleRequest request)
08.
{
09.
RouteContentRule entity;
10.
11.
if
(!Db.Exists<Route>(
new
{ Id = request.RouteId }))
12.
{
13.
throw
new
HttpError(HttpStatusCode.BadRequest, $
"Route with id {request.RouteId} does not exist"
);
14.
}
15.
if
(request.Id != 0)
16.
{
17.
var routeContentRule = _dbConnectionFactory.OpenReadOnlyAndRun(dbConn => dbConn.SingleById<RouteContentRule>(request.Id));
18.
entity = request.ToEntity(routeContentRule);
19.
Db.Update(entity, r => r.Id == routeContentRule.Id);
20.
return
entity.ToModel();
21.
}
22.
23.
entity = request.ToEntity();
24.
entity.OrderId = (_dbConnectionFactory.OpenReadOnlyAndRun(dbConn => dbConn.Scalar<RouteContentRule,
int
?>(x => Sql.Max(x.OrderId), x => x.RouteId == request.RouteId)) ?? 0) + 1;
25.
var id = (
int
)Db.Insert(entity,
true
);
26.
entity.Id = id;
27.
28.
return
entity.ToModel();
29.
}
30.
31.
public
void
Delete(DeleteRouteContentRuleRequest request)
32.
{
33.
Db.Delete<RouteContentRule>(
new
{Id = request.Id});
34.
}
Data during read request is as follows:
01.
[
02.
{
03.
"Id"
:35,
04.
"OrderId"
:1,
05.
"RouteId"
:72303,
06.
"SenderMatch"
:
"335"
,
07.
"ContentMatch"
:
""
,
08.
"SenderReplace"
:
""
,
09.
"ContentReplace"
:
""
10.
},
11.
{
12.
"Id"
:36,
13.
"OrderId"
:2,
14.
"RouteId"
:72303,
15.
"SenderMatch"
:
"55"
,
16.
"ContentMatch"
:
""
,
17.
"SenderReplace"
:
""
,
18.
"ContentReplace"
:
""
19.
}
20.
]
Problem is that grid is not showing these data. I can see that data is here if I click on grid cell. In that situation that cell become editable and it is showing current value of data. But as soon as I move editing to some new cell previous hide data. I was inspecting cell and I have found out that when cell is not editing it is described as following:
1.
<
td
style
=
"text-align: right"
aria-describedby
=
"50349c08-da61-49d2-aa73-9c0823d4a4a4"
role
=
"gridcell"
>
2.
<
span
><
label
class
=
"SenderMatch"
<=""
label
=
""
></
label
></
span
>
3.
</
td
>
And when cell is in edding mode it is described in html as following:
1.
<
td
style
=
"text-align: right"
aria-describedby
=
"ccc2df23-b49a-4b00-820a-02a67c428a52"
role
=
"gridcell"
id
=
"Grid_active_cell"
class
=
"k-edit-cell"
data-role
=
"editable"
>
2.
<
input
type
=
"text"
class
=
"k-input k-textbox"
name
=
"SenderMatch"
data-bind
=
"value:SenderMatch"
>
3.
</
td
>
I do not know why data is not showing. From what I can tell it should show data, but it is not showing this data.
Does the kendo grid support multi-header , multi-data low layout?
I attached the table layout that I want.
Hello,
I can't seem to find a way to sort my filter values into alpha order when the values are being pulled from JSON. Previously filtername.sort() had worked when I had the JSON data directly on the page but that is not an option with this implementation.
Live page:
https://www.ccah-alliance.org/Urgent-Visit-Providers.html
Code:
<div id="grid"></div>
<script>
$(document).ready(function () {
var myDataSource =
new kendo.data.DataSource({
data: JSON,
schema: {
model: {
fields: {
"ProviderName": { type: "string" },
"OfficeName": { type: "string" },
"OfficeAddress": { type: "string" },
"OfficeCityStateZip": { type: "string" },
"PrimarySpecialty": { type: "string" },
"ProviderLanguages": { type: "string" },
"Hospitals": { type: "string" }
}
}
},
transport: {
read: "/aspnetforms/UrgentVisitProviders.ashx"
},
pageSize: 15,
sort: [
{ field: "OfficeCityStateZip", dir: "asc" },
]
});
myDataSource.read();
$("#grid").kendoGrid({
dataSource: myDataSource,
dataBound:
function (e) {
var data = $("#grid").data("kendoGrid").dataSource._data;
for (i = 0; i < data.length; i++) {
if (myCities.indexOf(data[i].OfficeCityStateZip) === -1) {
myCities.push(data[i].OfficeCityStateZip);
}
if (mySpecialty.indexOf(data[i].PrimarySpecialty) === -1) {
mySpecialty.push(data[i].PrimarySpecialty);
}
if (myLanguages.indexOf(data[i].ProviderLanguages) === -1) {
myLanguages.push(data[i].ProviderLanguages);
}
if (myHospitals.indexOf(data[i].Hospitals) === -1) {
myHospitals.push(data[i].Hospitals);
}
}
},
columns: [{
field: "ProviderName",
title: "Provider",
width: 80,
filterable: false
},
{
field: "OfficeName",
title: "Office",
width: 110,
filterable: false
},
{
field: "OfficeAddress",
title: "Address",
width: 100,
filterable: false
},
{
field: "OfficeCityStateZip",
title: "City/State/Zip",
width: 105,
filterable: {
ui: cityFilter
}
},
{
field: "PrimarySpecialty",
title: "Specialty",
width: 80,
filterable: {
ui: specialtyFilter
}
},
{
field: "ProviderLanguages",
title: "Languages Spoken",
width: 85,
filterable: {
ui: languagesFilter
}
},
{
field: "Hospitals",
title: "Hospital",
width: 100,
filterable: {
ui: hospitalFilter
}
}],
sortable: true,
height: 900,
navigatable: true,
filterable: {
extra: false,
operators: {
string: {
eq: "Only show"
}
}
},
pageable: {
alwaysVisible: true,
pageSizes: [5, 10, 20, 100]
}
});
var myCities = [];
var mySpecialty = [];
var myLanguages = [];
var myHospitals = [];
myCities.sort();
mySpecialty.sort();
myLanguages.sort();
myHospitals.sort();
function languagesFilter(element) {
element.kendoDropDownList({
dataSource: myLanguages,
optionLabel: "--Select Language--"
});
}
function cityFilter(element) {
element.kendoDropDownList({
dataSource: myCities,
optionLabel: "--Select City--"
});
}
function specialtyFilter(element) {
element.kendoDropDownList({
dataSource: mySpecialty,
optionLabel: "--Select Specialty--"
});
}
function hospitalFilter(element) {
element.kendoDropDownList({
dataSource: myHospitals,
optionLabel: "--Select Hospital--"
});
}
});
</script>