Telerik Forums
Kendo UI for jQuery Forum
1 answer
320 views

I have the the following code:

module App.UI {
    export class News extends App.UI.UIComponent {
        constructor(selector: JQuery | string) {
            super(selector);
        }

        protected init() {
            var dataSource = new kendo.data.DataSource({
                transport: {
                    read: () => {
                        App.WCF.GET('/umbraco/aawNewsSurfaceController/NewsSurface/GetNewsItems?lang=de&id=1396').then((response) => {
                            console.log(response, "response");
                        })
                    }
                },
                pageSize: 21
            });

            console.log(dataSource);

            $("#pager").kendoPager({
                dataSource: dataSource
            });

            $(".news-list-view").kendoListView({
                dataSource: dataSource,
                template: kendo.template($("#ListViewTemplate").html())
            });
        }
    }
}

The Response from my Service is the following JSON String:

[ { "Headline": "Lorem Ipsum", "Content": "<p>Lorem ipsum ...</p>", "PublishDate": "2020-08-07T00:00:00", "Image": { "Description": "", "Photographer": [], "UmbracoFile": { "src": "/media/bedfs1h5/bild02.jpg", "focalPoint": { "left": 0.5, "top": 0.5 }, "crops": [ { "alias": "Reference Slider", "width": 800, "height": 545, "coordinates": null }, { "alias": "Slider", "width": 1070, "height": 600, "coordinates": null }] }, "Key": "fcdafa9b-3dff-407d-88b2-a4b85a9b2ac5", "Id": 1330, "Name": "Porsche Schwarz", "UrlSegment": null, "Level": 4, "Path": "-1,1111,1062,1146,1330", "Cultures": { "": { "Culture": "", "Date": "2020-07-13T15:47:22.943Z" } } } }, { "Headline": "Test 2", "Content": "<p>Test</p>", "PublishDate": "2020-08-15T00:00:00", "Image": { "Description": "", "Photographer": [ "Karl Kani" ], "UmbracoFile": { "src": "/media/pmpbnlqi/porsche.jpg", "focalPoint": { "left": 0.71333333333333337, "top": 0.34261241970021411 }, "crops": [ { "alias": "Reference Slider", "width": 800, "height": 545, "coordinates": { "x1": 0.0, "y1": 0.032119914346895075, "x2": 0.0, "y2": 0.092612419700214138 } }, { "alias": "Slider", "width": 1070, "height": 600, "coordinates": null } ] }, "Key": "3e95e2e9-c808-48d2-a71e-efca00d8ba55", "Id": 1147, "Name": "Porsche-Zentrum, Stuttgart-Zuffenhausen", "UrlSegment": null, "Level": 4, "Path": "-1,1111,1062,1146,1147", "Cultures": { "": { "Culture": "", "Date": "2020-03-04T09:28:31.753Z" } } } } ]

 

The JSON String can be parsed into a valid JSON Object so it should be fine right? So whats the Problem here? I also tried using the following schema:

 var dataSource = new kendo.data.DataSource({
                transport: {
                    read: () => {
                        App.WCF.GET('/umbraco/aawNewsSurfaceController/NewsSurface/GetNewsItems?lang=de&id=1396').then((response) => {
                            console.log(response, "response");
                        })
                    }
                },
                schema: {
                    type: "json",
                    model: {
                        fields: {
                            Headline: { field: "Headline", type: "string" },
                            Content: { field: "Content", type: "string" },
                            PublishDate: { field: "PublishDate", type: "DateTime" },
                            Image: { field: "Image", type: "Object" }
                        }
                    }
                },
                pageSize: 21
            });

And still my ListView Datasource wont get populated.

Any Help would be appreciated.

Thank you.

 

Petar
Telerik team
 answered on 18 Aug 2020
1 answer
168 views

Hi,

 

I have the export to excel button on my grid. I want all the cells to be expanded so that i can see the entire content of each cell in excel.

 

I have attached screenshots below for the same.

 

Here is the link to the demo:-

https://dojo.telerik.com/OMetasiq

 

Ivan Danchev
Telerik team
 answered on 17 Aug 2020
9 answers
544 views

Hi all
I am trying to format the date data to this format: "yyyy-MM-dd HH: mm: ss".
The function I am using is:

excelExport: function(e) {
    var sheet = e.workbook.sheets[0];
    var grid = e.sender;
    var fields = grid.dataSource.options.fields;
    var fieldsModels = grid.dataSource.options.schema.model.fields;
    var columns = grid.columns;
    var dateCells = [];
    
    var len = fields.length - 1; //subtract one because a column is added with a command button
    for (var i = 0; i < len; i++) {
        var currentField = fields[i].field;
        var currentModel = fieldsModels[currentField];
        
        if (currentModel.type === "date") 
            for (var j = 0; j < columns.length; j++) {
                if (currentField === columns[j].field) {
                    dateCells.push(j);
                    break;
                };
            };
        };
    };
    for (var rowIndex = 1; rowIndex < sheet.rows.length; rowIndex++) {
        var row = sheet.rows[rowIndex];
        for (var q = 0; q < dateCells.length; q++) {
            var cellIndex = dateCells[q];
            if(row.cells[cellIndex]){
                row.cells[cellIndex].format = "yyyy-MM-dd HH:mm:ss";}
        };
    };
}

When I export without grouping, the date field in the excell has the expected format, but when I export grouped by another string type field the date field shows a format "yyyy-MM-dd".
How could I solve this?

Anton Mironov
Telerik team
 answered on 17 Aug 2020
1 answer
329 views

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?

Viktor Tachev
Telerik team
 answered on 17 Aug 2020
3 answers
612 views

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?

Tsvetomir
Telerik team
 answered on 17 Aug 2020
1 answer
116 views

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

Silviya Stoyanova
Telerik team
 answered on 17 Aug 2020
3 answers
259 views

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.

Plamen
Telerik team
 answered on 17 Aug 2020
1 answer
109 views

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!

Silviya Stoyanova
Telerik team
 answered on 17 Aug 2020
3 answers
273 views

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);
}
});

Viktor Tachev
Telerik team
 answered on 14 Aug 2020
1 answer
3.9K+ views

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?

 

 

 

Silviya Stoyanova
Telerik team
 answered on 14 Aug 2020
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?