Telerik Forums
Kendo UI for jQuery Forum
6 answers
1.1K+ views

Hi,

We are currently evaluating the Kendo UI javascript Grid. We`d like  to bind it to a datasource populated from a remote rest service. The json returned will be similar to the json at the bottom of this post. We would like the grid to bind to the stock array but not the summary but would like the summary accessible from the datasource.

I`ve tried calling the rest service from jquery then populating the datasource using the array but this seems slower then binding the datasource to the rest service directly.

Below is an example of what we`d like to do

Many thanks

Darran

var dataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "/warehouse/report",
                    dataType: "json"
                }
            },
            schema: {
                data: "breaks",
                total: function(response) {
                    return $(response.breaks).length;
                }
            },
            groupable: true,
            sortable: true,
            pageSize: 100,
            page:1
        });
 
 
$(gridId).kendoGrid({
            dataSource: dataSource.breaks, //How do we bind to the breaks only???
            selectable: "multiple cell",
            allowCopy: true,
            columns: columnDefinitions(),
            columnMenu: true,
            filterable: true,
            sortable: {
                mode: "single",
                allowUnsort: false
            },
            pageable: {
                refresh: true,
                pageSizes: true,
                buttonCount: 5
            },
            groupable: true
        });

Example Json:

{summary{colour:red,size:10},
   stock:[{name:"name1",type:"type1"},
          {name:"name2",type:"type2"},
          {name:"name3",type:"type3"}
]}

Boyan Dimitrov
Telerik team
 answered on 26 Mar 2018
4 answers
351 views
Hi,

I had a question about Splitter. Is it possible to create a splitter dynamically - I know that in theory this is possible.

But I wanted to find out about performance, and any other issues there may be.

Thanks

Uma
Svet
Telerik team
 answered on 26 Mar 2018
6 answers
1.3K+ views

Hello

I've just upgraded from KendoUI v2017.3.913 to KendoUI v2018.1.221 and had some not nice visual changes in kendoDialog and kendoConfirm.

See attachment:
- KendoUI v2017_3_13.png : How it was and how I would like to have it again
- KendoUI v2018_1_221.png : Screwed up in latest KendoUI version

Two unwanted things in latest release:
1. Pressed button, ignoring content
2. Unwanted grey bar at the bottom of the dialog (same bar with title activated)

-> I have the exactly same problem in kendoDialog and kendoConfirm.

To point 1:
Of course it works in your widget samples, so I made a standalone sample (outside from my project). The button appears but is not fully visible. I have the fully working code here:

<!DOCTYPE html>
<html lang="en">
 
    <head>
        <meta charset="UTF-8">
        <!-- Telerik Framework -->
        <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2018.1.221/styles/kendo.common.min.css" />
        <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2018.1.221/styles/kendo.blueopal.min.css" />
        <script src="http://kendo.cdn.telerik.com/2018.1.221/js/jquery.min.js"></script>
        <script src="http://kendo.cdn.telerik.com/2018.1.221/js/kendo.all.min.js"></script>
 
        <!-- Font Awesome -->
        <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
 
        <style type="text/css">
 
            .green {
                color: #208e14;
            }
 
        </style>
 
        <script>
            $(document).ready(function() {
 
                $("#dialog").kendoDialog({
                    title: false,
                    width: 900,
                    height: 400,
                    closable: false,
                    buttonLayout: "normal",
                    actions: [{
                        text: "<i class='fas fa-check green' style='font-size: 18px; width: 30px;'></i>",
                        action: function(e){
                            // e.sender is a reference to the dialog widget object
                            alert("OK action was clicked");
                            // Returning false will prevent the closing of the dialog
                            return true;
                        },
                    }]
                });
 
            });
 
        </script>
 
    </head>
 
    <body>
        <div id="dialog"></div>
    </body>
</html>

 

The fact the button is pressed in my project is a problem I have to find but I don't understand why the button is not centered/fully visible in the code above.

 

To point 2 (grey bar):

I've checked the API documentation of kendoDialog and kendoConfirm how to get rid off that grey bar but couldn't find something. If I wanted a grey bar I would place it by myself. So I don't understand why Telerik changed the layout that way

The question here is: How can I get rid off that unwanted grey bar at the bottom (probably same way as on top with active title).

Regards

 

 

 

Tayger
Top achievements
Rank 1
Iron
Iron
 answered on 24 Mar 2018
1 answer
171 views

Hello,

I have a use case where I want to change the event function (_dialogActionOK, _dialogInitOpen, _dialogOpen) called by the dialog window runtime.

$('#dialog').kendoDialog({
...
actions: [
    { text: 'Cancel'},
    { text: 'OK', primary: true, action: function(e) { _dialogActionOK(); } }
],
initOpen: function (e) { _dialogInitOpen(); },
open: function (e) { _dialogOpen(); }

 

What is the simplest way to change the functions called runtime?

$('#dialog').initOpen( function(e) { newMethod(); }) ?

Thanks for the help

Simon
Top achievements
Rank 1
 answered on 23 Mar 2018
5 answers
331 views
I have a calculated non editable cell bound to a datasource model.  While editing the cell value is calculated, the new value is reflected in the model but does not render to the screen.
Any ideas?

export function init(columns: any) {
        var ds = new nkfDataSources.FilterByJobQuickEntryDistribution();
        ds.group = { field: "PropertyName" };
        grid = $("#jobQuickEntryDistributionGrid").kendoGrid({
            columns: columns,
            groupable: false,
            pageable: true,
            sortable: true,
            filterable: true,
            toolbar: kendo.template($("#grid_jobQuickEntryDistribution_toolbar").html()),
            dataSource: ds.get(onGridparameterMap),
            editable: true,
            edit: function (e) {
                e.model.unbind("change", model_change).bind("change", model_change);
            }
        }).data("kendoGrid");
    }
    function model_change(e) {
        var model = this;
       
        model.NetFee = nkfCommon.Calculate.netFee(
            model.GrossFee,
            nkfCommon.Calculate.departmentOffset(model.GrossFee, model.DepartmentOffset),
            nkfCommon.Calculate.expenses(model.ClientReimbursedExpenses, model.NonClientReimbursedExpenses, model.DirectBilledExpenses));
}
    var columns = [
        { field: "AppraiserName", title: "@Resources.NGage.JobQuickEntryResource.AppraiserNameField", width: "18%" },
        { field: "RoleTypeDescription", title: "@Resources.NGage.JobQuickEntryResource.RoleTypeDescriptionField", width: "17%" },       
        { field: "GrossFee", title: "@Resources.NGage.JobQuickEntryResource.GrossFeeField", format: "{0:c}", width: "10%", attributes: { style: "text-align:right" } },
        { field: "DepartmentOffset", title: "@Resources.NGage.JobQuickEntryResource.DepartmentOffsetField", format: "{0:p5}", width: "10%", attributes: { style: "text-align:right" } },
        { field: "ClientReimbursedExpenses", title: "@Resources.NGage.JobQuickEntryResource.ClientReimbursedExpensesField", format: "{0:c}", width: "10%", attributes: { style: "text-align:right" } },
        { field: "NonClientReimbursedExpenses", title: "@Resources.NGage.JobQuickEntryResource.NonClientReimbursedExpensesField", format: "{0:c}", width: "10%", attributes: { style: "text-align:right" } },
        { field: "DirectBilledExpenses", title: "@Resources.NGage.JobQuickEntryResource.DepartmentOffsetField", format: "{0:c}", width: "10%", attributes: { style: "text-align:right" } },
        {
            field: "NetFee",
            title: "@Resources.NGage.JobQuickEntryResource.NetFeeField",
            format: "{0:c}",
            width: "10%",
            attributes: { style: "text-align:right" },
            footerTemplate: "<span style='float:right'>#= kendo.toString(@ViewBag.JobTeamDistributionAmount, 'c2')# </span>"
        },
        { field: "", title: " ", width: '6%', template: "<a href='/JobQuickEntry/Edit/#: Id #' class='row-link-padding' style='padding-right:0; padding-left:0' >@Resources.MessageResources.EditField</a> ", editable: false },
    ];

Regards

Floyd

Viktor Tachev
Telerik team
 answered on 23 Mar 2018
2 answers
552 views

I'm trying to implement a Kendo splitter pane with dynamically allocated number of panes in Angular 2. I have the kendo-splitter element in the parent component but unless I remove it the child component doesn't get rendered? 

Parent Splitter Component

import { Component, OnInit } from '@angular/core';
import { BrxDelta } from '../model/BrxDelta';
 
@Component({
  selector: 'app-all-deltas',
  template: `<kendo-splitter orientation="vertical" style="height: 340px;">
 
              <app-brx-delta *ngFor="let b of brxDeltas" [brxDelta]="b"></app-brx-delta>
 
            </kendo-splitter>`,
  styleUrls: ['all-deltas.component.scss']
})
export class AllDeltasComponent implements OnInit {
 
  brxDeltas: BrxDelta[];
 
  constructor() {
    this.brxDeltas = [
      new BrxDelta("DELTA1"),
      new BrxDelta("DELTA2")
    ];
  }
 
  ngOnInit() {
    console.log("BrxTableListComponent init");
    console.log( this.brxDeltas );
  }
 
}

Child Pane Component
import { Component, OnInit, Input} from '@angular/core';
import { BrxDelta } from '../model/BrxDelta';
 
@Component({
  selector: 'app-brx-delta',
  template: `<kendo-splitter-pane size="100px">
                <div class="pane-content">
                  <h3>{{brxDelta.deltaName}}</h3>
                </div>
              </kendo-splitter-pane>
              `,
  styleUrls: ['brx-delta.component.scss']
})
export class BrxDeltaComponent implements OnInit {
 
  @Input('brxDelta') brxDelta:BrxDelta;
 
  ngOnInit() {
    console.log( this.brxDelta );
  }
 
}

 

Svet
Telerik team
 answered on 23 Mar 2018
4 answers
409 views

Hi

I have issue selecting first tab, I read  in https://www.telerik.com/forums/can-t-programmatically-select-a-tab#8GpHjbXuJkyTYw-siBriCw that the issue can be because of the external dataSource. I use the example from http://demos.kendoui.com/web/tabstrip/images.html to create my json. here is part of my code. Any idea?

var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/api/GetTabs/",
dataType: "json",
type: "POST"
},
parameterMap: function (data, type) {
var result = {
val1: $("#val1").val(),
val2: $("#val2").val(),
}
return kendo.stringify(result);
}
},
});

$("#tabstrip").kendoTabStrip({               
dataTextField: "resId",
dataContentUrlField: "resName",
dataSource: dataSource
                
            });

 

function SelecTab() {    
var tabStrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");
tabStrip.select(1);
}

Claudia
Top achievements
Rank 1
 answered on 22 Mar 2018
3 answers
341 views

Kendo grids in our application are not sizing optimally with Chrome 65.  Our grid columns still size efficiently and as expected in Chrome 64, and the latest of Firefox, IE 11, and Edge. 

Attachment 1 shows one of our grids, rendered in Chrome 65.  Here you can see that the columns which would normally be wider, to accommodate wider text, are too thin, and columns which do not have a lot of text are too wide.

Attachment 2 shows the same grid as rendered in Firefox.  (Also renders this way in Chrome 64, IE 11 and Edge)

Attachment 3 shows that a forced redraw of the grid columns, by executing the following code, corrects the column sizing issues.  Perhaps Chrome has become faster, and exposed a timing issue around column width calculations after options.success is called following a transport.read?

                                                //The following is executed after the return of data from an external query made in
                                                //kendo.data.DataSource.transport.read
                                                //Attachment 1 is from just prior to this code's execution.
                                                //Attachment 2 is from after showColumn(3) is execcuted
                                                window.setTimeout(angular.bind(this,
                                                    () => {
                                                        $("#ehGrid").data("kendoGrid").hideColumn(3);
                                                        window.setTimeout(angular.bind(this,
                                                                () => {
                                                                    $("#ehGrid").data("kendoGrid").showColumn(3);
                                                                }),
                                                            100);
                                                        }),
                                                    300);

This issue is occurring in multiple grids in our app, so having to put this workaround into all our transport.read definitions is not a great solution for us.  Do you have any other suggestions or a fix? 

Kendo 2017.1.223, Angular v1.6.5, Typescript

Stefan
Telerik team
 answered on 22 Mar 2018
1 answer
220 views

Hello,

in this example http://dojo.telerik.com/aJUKiZuB I reproduced a problem with the dropdown. When you open it and directly close it (before its opened) by clicking i.e. below, there is a faulty animation, where the dropdown animation container jumps to a wrong position. With jQuery 1 its working fine. Same problem seems to be on multiselect (maybe also on other widgets?).

 

Regards

Jan

Ivan Danchev
Telerik team
 answered on 22 Mar 2018
1 answer
497 views

I would like to collapse all of the nodes in the treeview and then expand the treeview to a specific node. I have found that when i call the collapse function like treeview.collapse('.k-item') and then try to call treeview.expandTo(dataItem) the treeview closes and does not expand to the node. In order to get it to work I have to delay the expandTo by using setTimout. This is not ideal. Any help would be appreciated.

Dojo example: http://dojo.telerik.com/ATiXUbuC

 

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Untitled</title>

  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.common.min.css">
  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.rtl.min.css">
  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.default.min.css">
  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.mobile.all.min.css">

  <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
  <script src="https://kendo.cdn.telerik.com/2018.1.221/js/angular.min.js"></script>
  <script src="https://kendo.cdn.telerik.com/2018.1.221/js/jszip.min.js"></script>
  <script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.all.min.js"></script></head>
  
<div id="example">

            <div class="demo-section k-content">
                <h4>Inline data (default settings)</h4>
                <div id="treeview-left"></div>
              <button onclick='expandTo()'>Expand To</button>
              <span><--works as expected</span><br/>
              <button onclick='find()'>Collapse then expand to node</button>
              <span><-- sometimes works on first time, but stops working</span><br/> 
              <button onclick='findWithDelay()'>Collapse then expand to node (with delay)</button>
              <span><-- works everytime
              
            </div>

            <script>
                var inlineDefault = new kendo.data.HierarchicalDataSource({
                    data: [
                        { text: "Furniture", items: [
                            { text: "Tables & Chairs" },
                            { text: "Sofas" },
                            { text: "Occasional Furniture" }
                        ] },
                        { text: "Decor", items: [
                            { text: "Bed Linen" },
                            { text: "Curtains & Blinds" },
                            { text: "Carpets" }
                        ] }
                    ]
                });

                $("#treeview-left").kendoTreeView({
                    dataSource: inlineDefault
                });
              
              
              //expandTo on its own works as expected
              function expandTo(){
                var treeView = $('#treeview-left').data('kendoTreeView');
                var node = treeView.findByText('Sofas');
                dataItem = treeView.dataItem(node);
                treeView.expandTo(dataItem);
              }
              
              //I want to close all the nodes and then expand the treeview to a specific node
              //but calling expandTo after calling collapse doesn't work
              function find(){
                var treeView = $('#treeview-left').data('kendoTreeView');
                treeView.collapse('.k-item');
                var node = treeView.findByText('Sofas');
                dataItem = treeView.dataItem(node);
                treeView.expandTo(dataItem);
              }
              
              //have to delay the expandTo call to make it work
              function findWithDelay(){
                var treeView = $('#treeview-left').data('kendoTreeView');
                treeView.collapse('.k-item');
                var node = treeView.findByText('Sofas');
                dataItem = treeView.dataItem(node);
                
                //delay the expandTo for half a second
                setTimeout(function(){treeView.expandTo(dataItem)}, 500);
              }
  </script>

            <style>
                #example {
                    text-align: center;
                }

                .demo-section {
                    display: inline-block;
                    vertical-align: top;
                    text-align: left;
                    margin: 0 2em;
                }
            </style>
        </div>
<body>
</body>
</html>

Neli
Telerik team
 answered on 21 Mar 2018
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
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?