Telerik Forums
Kendo UI for jQuery Forum
1 answer
134 views
How to open with zoom:in effect  - but with a start value e.g. 0.7? That will look nicer - like Windows 10 window open (zoom a little with fade)
Anders Mad.
Top achievements
Rank 2
 answered on 13 Aug 2015
4 answers
276 views

I'm getting the following error when using the Telerik Kendo UI Chrome Inspector:

 Uncaught TypeError: Cannot read property 'get' of null (Line 94, in the makeWidgetInfo method)

 This error is repeated 14 times or so, roughly corresponding to the number of Kendo widgets/bindings in the DOM at the time.

I found one google result for this: http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback/suggestions/6502730-fixing-error-in-chrome-inspector#{toggle_previous_statuses}

I didn't find any corresponding posts in the forums: http://www.telerik.com/search?start=0&q=%2522Chrome%2bInspector%2522%2berror&collection=telerik30&ResourceType=Forum&hgurl=kendo%252Dui

I'm not sure that I can readily post code to duplicate, but I'm hoping someone familiar with the inspector can give me a clue as to what's happening; essentially I just need to know if this is an error in the Inspector, or an error in my code somewhere. It's notable that I'm not seeing any problems otherwise, either in the console, or visually while using the application. 

 

 

Travis
Top achievements
Rank 1
 answered on 13 Aug 2015
5 answers
1.9K+ views
I wanted to select an item in the grid and remove that row manually.

Here is my function associated with a button (not included part of the grid):

 //delete the selected row
        $("#delete_b").click(function () {
            alert('delete clicked');
            var grid = $("#grid").data("kendoGrid");
            console.log('delete clicked');
            grid.select().each(function() {
                var dataItem = grid.dataItem($(this));
                grid.removeRow(dataItem.BrandID);
            });
       });

please let me know why this is not working!

Hari
Top achievements
Rank 1
 answered on 13 Aug 2015
1 answer
163 views

Hello,

The objective is to make a CSS style editor. Code is available at https://jsfiddle.net/9b1umpmj/2/.

The issue I am facing is focused on the cssDropDownEditor function on line 190. The version of the code without validation works as desired (simply remove the name attribute when creating the combobox line 191):

function cssDropDownEditor(container, options) {
    $('<input data-bind="value: ' + options.field + '" required data-required-msg="' + that.options.messages.validation.name + '">')
        .appendTo(container)
        .kendoComboBox({
            autoBind: false,
            change: function(e) {
                // The change event handler assigns a default value depending on the style name
                if (e /*instanceof $.Event*/ && e.sender instanceof kendo.ui.ComboBox) {
                    var dataItem = e.sender.dataItem(),
                        // grid = container.closest('.k-grid').data('kendoGrid'),
                        grid = that.element.data('kendoGrid'),
                        uid = container.parent().attr(kendo.attr('uid'));
                    if (grid instanceof kendo.ui.Grid && $.type(uid) === 'string' && $.type(dataItem) !== 'undefined') {
                        var style = grid.dataSource.getByUid(uid);
                        style.set('value', dataItem.get('value'));
                    }
                }
            },
            //dataSource: viewModel.css,
            dataTextField: 'name',
            dataValueField: 'name'
        })
        .data('kendoComboBox');
    $('<span class="k-invalid-msg" data-for="style_name"></span>').appendTo(container);
}

The version with validation does not work as desired. Actually the viewModel is not updated. To test it modify line 191 ​to add a name attribute as follows: 

$('<input name="style_name" data-bind="value: ' + options.field + '" required data-required-msg="' + that.options.messages.validation.name + '">')

The reason is the following:

  1. The combobox creates an input named style_name_input;
  2. The grid uses this name to bind this input as follows data-bind="value: style_name_input", which obviously does not exist in the viewModel,
  3. therefore data-binding with the viewModel does not work when specifying a name as required for validation.

Any workwaround/fix?

 

 

 

 

Jack
Top achievements
Rank 2
Iron
 answered on 13 Aug 2015
3 answers
183 views

Greetings!  I wish to fill three grids from a single datasource (call to metered API).  The API returns 30 rows, I want rows 1 - 10 in grid1, rows 11-20 in grid2 and rows 21-30 in grid3.

My data source (copied from your web API demo) is 

$(document).ready(function () {
    var MedicareRiskDataSource = new kendo.data.DataSource(
    {
        transport: {
            read: {
                url: "http://apiqa.frankcohengroup.com/ProcedureUtil/1/2013",
                type: "GET",
                dataType: "json",
                beforeSend: function (req) {
                    req.setRequestHeader("FCG-ApiKey", "DA103B60C7A340FFA85532F716FC478D");
                }
            }
        },
        schema: {
            data: function (response) {
                return response.Metrics;
            },
            model: {
                id: "MetricID",
                fields: {
                    MetricID: {
                        type: "number"
                    },
                    MetricDescription: {
                        type: "string"
                    },
                    PhysicianValue: {
                        type: "number"
                    },
                    SpecialtyValue: {
                        type: "number"
                    },
                    VarianceValue: {
                        type: "number"
                    }
                }
            }
        },

I can filter here, with 

filter: { field: "MetricID", operator: "lt", value: 11 }

 or 

filter: {
    logic: "and",
    filters: [
        { field: "MetricID", operator: "gt", value: 10 },
        { field: "MetricID", operator: "lt", value: 21 }
    ]
}
etc.

However, that would require three data sources and thus three calls to the API, which we pay for.

My grids look alike, with different names

$("#allServicesGrid").kendoGrid({
    dataSource: MedicareRiskDataSource,
    scrollable: false,
    columns: [
        {
            field: "MetricDescription",
            title: "Name",
            width: 400
        },
        {
        field: "PhysicianValue",
        title: "Physician",
        width: 100
    },
    {
        field: "SpecialtyValue",
        title: "Specialty",
        width: 100
    },
    {
        field: "VarianceValue",
        title: "Variance",
        width: 100
    }]
});

I've added "filterable" to the grid, but that
    1) enables the icon on the column header which I do not want

2) 

 

 

 

 â€‹

Scott Buchanan
Top achievements
Rank 1
 answered on 13 Aug 2015
1 answer
137 views
I would like my end users to have the ability to clear the combobox values and save the blank data.  When you clean the value and tab away from the combobox the gird shows the previous value and a change event for that row is not fired.

function loadEmployeeInfoGrid() {
 
    var ds = new kendo.data.DataSource({
        transport: {
            read: {
                url: "/asgweb/ga_WebApi/api/dv_Timesheets/AdminTimeSheetEmployeeInfoLoad",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                type: "GET"
            },
            update: {
                url: "/asgweb/ga_WebApi/api/dv_Timesheets/AdminTimeSheetEmployeeInfoUpdate",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                type: "PUT"
            },
            parameterMap: parameterMap
        },
        pageSize: 50,
        schema: {
            model: {
                id: "EmployeePhoneId",
                fields: {
                    EmployeePhoneId: { type: "number", editable: false },
                    EmployeeName: { type: "string", editable: false },
                    product: {                    },
                    TimeSheetStartDate: { type: "date", editable: true },
                    ManagerName: { type: "string", editable: false },
                    manageroverride: { },
                    ModifiedBy: { type: "string", editable: false },
                    ModifiedDate: { type: "date", editable: false }
                }
            }
        },
        batch: true,
        sort: { field: "EmployeeName", dir: "asc" }
    });
 
    var grdEmployeeInfo = $("#grdEmployeeInfo").kendoGrid({
        excel: {
            fileName: "EmployeeInfo.xlsx",
            proxyURL: "http://demos.telerik.com/kendo-ui/service/export",
            filterable: true
        },
        allowCopy: true,
        dataSource: ds,
        filterable: true,
        sortable: true,
        navigatable: true,
        scrollable: false,
        editable: true,
        groupable: false,
        pageable: {
            refresh: true,
            pageSizes: true,
            previousNext: true
        },
        toolbar: ["save", "cancel", "excel"],
        columns: [
            { field: "EmployeeName", title: "Employee", width: "200px" },
            { field: "product", title: "Product", width: "150px", editor: productDropDownEditor, template: "#=product.textField#", filterable: false },
            { field: "TimeSheetStartDate", title: "TS Start Date", format: "{0:MM/dd/yyyy}", width: "30px", filterable: true },
            { field: "ManagerName", title: "Manager", width: "30px" },
            { field: "manageroverride", title: "Manager Override", width: "150px", editor: manageroverrideDropDownEditor, template: "#=manageroverride.textField#", filterable: false },
            { field: "ModifiedBy", title: "Modified By", width: "100px", filterable: false },
            { field: "ModifiedDate", title: "Modified Date", format: "{0:MM/dd/yyyy}", width: "30px", filterable: false }
        ]
    });
 
}
 
function parameterMap(data, requestType) {
 
    if (requestType === 'create' || requestType === 'update') {
        return JSON.stringify(data);
    }
    return data;
}
 
function productDropDownEditor(container, options) {
    $('<input id="drpProduct" name="drpProduct" data-text-field="textField" data-value-field="valueField" data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoComboBox({
                    filter: "contains",
                    minLength: 2,
                    autoBind: false,
                    suggest: true,
                    dataSource: {
                        serverFiltering: true,
                        transport: {
                            read: {
                                url: "/asgweb/ga_WebApi/api/Dropdowns/",
                                dataType: "json",
                                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                                type: "GET",
                                data: {
                                    "srchFinder": "dv_TimeSheetProductFind",
                                    "srchText": function (e) { return $("#drpProduct").data("kendoComboBox").input.val(); },
                                    "srchFilter": "",
                                    "srchSort": ""
                                },
                            }
                        }
                    }
                    //change: function (e) { productChange(e, options); }
                });
    $('<span class="k-invalid-msg" data-for="drpProduct"></span>').appendTo(container);
}
 
function manageroverrideDropDownEditor(container, options) {
    $('<input id="drpManagerOverride" name="drpManagerOverride" data-text-field="textField" data-value-field="valueField" data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoComboBox({
                    filter: "contains",
                    minLength: 2,
                    autoBind: false,
                    placeholder: "Type or Select",
                    suggest: true,
                    dataSource: {
                        serverFiltering: true,
                        transport: {
                            read: {
                                url: "/asgweb/ga_WebApi/api/Dropdowns/",
                                dataType: "json",
                                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                                type: "GET",
                                data: {
                                    "srchFinder": "EmployeePhoneDirFind",
                                    "srchText": function (e) { return $("#drpManagerOverride").data("kendoComboBox").input.val(); },
                                    "srchFilter": " and ga_PhoneDirMain.ActiveStatus=1 ",
                                    "srchSort": ""
                                },
                            }
                        }
                    },
                    change: function () {
                        if (this.select() < 0) {
                            this.value("");
                        }
                    }
                });
    $('<span class="k-invalid-msg" data-for="drpManagerOverride"></span>').appendTo(container);
}

Boyan Dimitrov
Telerik team
 answered on 13 Aug 2015
1 answer
331 views

Consider the following scenario:

  1. Local dataSource is populated with .data()
  2. A new data item is added to the dataSource using .add()
  3. .cancelChanges() is called on the dataSource, item in #2 disappears

I tried inserting a .sync() call after item #2, but I found that .cancelChanges() will always remove newly added items to the DataSource that were added using .add().  After doing some additional research, I'm beginning to question exactly how local DataSource's are supposed to be used.  I've seen a lot of mention of having to use the four transport methods, and that the changes themselves should actually be persisted to a Javascript array, and after a .add(), the array should be updated and the .data() method should be called again.  How exactly should this be implemented?

I've put together a Dojo that illustrates the behavior from which I will base these questions:

http://dojo.telerik.com/uYaYI/4

In the initialization block, if I add each of my initial 25 items via .add(), then click on any one of them and hit "Cancel" then they are actually removed from the data source.  If I instead put my initial items in an array and call .data(), then the .cancelChanges seems to work as expected.  However, if I use the .add() method, then "Save," then try to hit it and then hit "Cancel" again I see that the item disappears.  When doing CRUD operations on a local dataSource, is it required that the data be persisted to a Javascript array?  For clarity, could someone explain why this is?

Nikolay Rusev
Telerik team
 answered on 13 Aug 2015
5 answers
1.0K+ views

Hi,

I can't figure out how to add my own properties to a treeview template.  I am using a model 'NodeViewModel' which gets populated in my controller from a back end data source, and I want some of the properties to be used in the template HTML.  However, the template only allows setting of basic properties (such as text, Id and expanded) because they use the TreeViewItem class which my model maps to (I'm not sure if there's another way of doing it, that's just from the examples I've worked with).  Below I have pasted by view and my model - any help is appreciated.  I am trying to get the property RiskColour to bleed through into the template displayed.

Any help would be massively appreciated.

Thanks, Mark

 

MY MODEL :-

public class NodeViewModel
    {
        public NodeViewModel()
        {
            this.Expanded = true;
            this.Children = new List<NodeViewModel>();
        }

        public int Id { get; set; }
        public string Title { get; set; }
        public bool Expanded { get; set; }
        public int SortOrder { get; set; }
        public string RiskColour { get; set; }   ====== THIS IS MY PROPERTY I AM HAVING ISSUES WITH

        public bool HasChildren
        {
            get { return Children.Any(); }
        }

        public IList<NodeViewModel> Children { get; private set; }
    }

 

MY VIEW :-

<script id="TreeViewTemplate" type="text/kendo-ui-template">
        <div style="text-align:left;">
            #: item.text # ASDAFF
        </div>
    </script>
    <script>
    function onSelect(e) {
        alert($(e.node).data("id"));
    }
    </script>
    @( Html.Kendo().TreeView()
        .Name("TreeViewTemplateBiding")
        // .Template("#: item.text #")
       // .TemplateId("TreeViewTemplate")
        .HtmlAttributes(new { @class = "alignleft" })
        .Events(events => events
            .Select("onSelect")
        )
        .BindTo((IEnumerable<TEAMSPortalV2.Models.NodeViewModel>)ViewBag.Tree, (NavigationBindingFactory<TreeViewItem> mappings) =>
        {
            mappings.For<TEAMSPortalV2.Models.NodeViewModel>(binding => binding.ItemDataBound((item, node) =>
            {
                item.Id = node.Id.ToString();
                item.Text = node.Title;
                item.Expanded = node.Expanded;
                item.RiskColour = node.RiskColour;    ====== THIS IS MY PROPERTY I AM HAVING ISSUES WITH - item.RiskColour generates an error :(
            })
            .Children(node => node.Children));
        })
     )

Mark
Top achievements
Rank 1
 answered on 13 Aug 2015
1 answer
875 views

Hi, ​we are writing mobile app and have heavy perfomance problems due to double event triggering

Example: double kendo open event

http://dojo.telerik.com/eFiKA

Why? Are there any workarounds?
Daniel
Telerik team
 answered on 13 Aug 2015
2 answers
304 views

The title for this issue is difficult to describe. Basically here is what we are doing.

1. Using MVVM to bind two search boxes that filter data in a kendo.data.DataSource. The filtering is by setting simple filters on the data source

2. The dataSource is bound to a table (not grid)

3. Each row contains a remove button

With no filters in place the remove operation works correctly. However with any filter applied I can only remove the first item in the list. However it is actually removing the first item in the datasource regardless of the filters, any other items cause an error 'Cannot read property 'kendoBindingTarget' of undefined'. Its hard to understand but if you checkout this jsfiddle

http://jsfiddle.net/habk2b5p/7/

 I have simulated a very cut down​ version of the trial. Basically to use try filter by one or both of the options. (Min 3 characters before filter), once filtered try and remove items. Place close attention to the 'Id' column that you remove as you will see that it actually wont remove the item you selected unless the item selected is id 1 (the first item in the data source).

Any help would be greatly appreciated.

ISEEUGlobal
Top achievements
Rank 1
 answered on 13 Aug 2015
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?