Telerik Forums
Kendo UI for jQuery Forum
3 answers
267 views
I can't figure out why the select even is not firing.  Consider the directives below and associated javascript even wiring.   Please advise.

<input id="customerSearch" placeholder="Search Customer"
                           kendo-auto-complete
                           k-suggest="true"
                           k-height="100"
                           k-data-text-field="'name'"
                           k-data-source="customerSearchDataSource"
                           ng-model="search"
                           k-template="'<span>${ data.name }</span>'">

 $(function () {
            $("#customerSearch").kendoAutoComplete({
                select: function (e) {
                    var item = e.item;  // never hits here.
...

                }
            });
Petyo
Telerik team
 answered on 12 Aug 2014
2 answers
334 views
Hello,

I'm currently working with Kendo UI and AngularJS and i've encountered an issue creating a custom directive to add a custom toolbar a grid.

What I need is a toolbar with a search input for a grid.

Here is the code :
- Controller :
controllers.MyCtrl1 = function($scope) {
        //Kendo Grid Test custom directive
        $scope.gridColumns = [{
            field: "ContactName",
            title: "Contact Name",
            width: 140
        }, {
            field: "ContactTitle",
            title: "Contact Title",
            width: 190
        }, {
            title: "Location",
            template: "{{dataItem.City}}, {{dataItem.Country}}"
        }, {
            title: "Selected",
            template: "{{dataItem.selected ? 'Yup' : 'Nope'}}"
        }];
 
        $scope.gridOptions = {
            selectable: true,
            sortable: true,
            pageable: true,
            dataSource: {
                type: "odata",
                transport: {
                    read: "http://demos.kendoui.com/service/Northwind.svc/Customers"
                },
                pageSize: 6
            },
            columns: $scope.gridColumns
        };
    };
    controllers.MyCtrl1.$inject = ['$scope'];

- Directive :
/* Directives */
 
    var toolboxDirectives = angular.module('myApp.directives', []);
 
    toolboxDirectives.directive('appVersion', ['version', function(version) {
        return function(scope, elm) {
            elm.text(version);
        };
    }]);
 
    // Sample directive.  Activate it by passing my-grid attribute to
    // the div which constructs the grid.  It expects your div to also
    // have a kendo-grid attribute, to activate the Kendo UI directive
    // for creating a grid.
    toolboxDirectives.directive('myGrid', ['$compile', function () {
        return {
            restrict: 'A',
            scope: true,
            controller: function ($scope) {
                window.crap = $scope;
                $scope.toggleSelectAll = function(ev) {
                    var grid = $(ev.target).closest("[kendo-grid]").data("kendoGrid");
                    var items = grid.dataSource.data();
                    items.forEach(function(item){
                        item.selected = ev.target.checked;
                    });
                };
            },
            link: function ($scope, $element, $attrs) {
                var options = angular.extend({}, $scope.$eval($attrs.kOptions));
                options.columns.unshift({
                    template: "<input type='checkbox' ng-model='dataItem.selected' />",
                    title: "<input type='checkbox' title='Select all' ng-click='toggleSelectAll($event)' />",
                    width: 50
                });
                options.toolbar = kendo.template("<div class='toolbar'><label>Search:</label><input type="search" /></div>");
                console.log(options);
            }
        };
    }]);

- HTML :
<div my-grid kendo-grid="grid" k-options="gridOptions"></div>

I've used an exemple made by someone on this forum to try this method. It works when it adds a column with the checkbox.
I've add a "console.log(options)" to see if the key "toolbar" was added in the JSON, and it is... But the toolbar doesn't appear...

I've tried to change the part :
options.toolbar = kendo.template("<div class='toolbar'><label for='grid-search'>Search:</label><input id='grid-search' ng-model='searchValue' /></div>");
By :
$scope.gridOptions.toolbar = kendo.template("<div class='toolbar'><label for='grid-search'>Search:</label><input id='grid-search' ng-model='searchValue' /></div>");
Which is not what I want, but for the grid which use this JSON as options it works...

I don't see what is the problem when I use a "generic" method... 
Maybe I've made a mistake, it's my first project using Kendo and AngularJS.

I'm aware for any advice.

(Sorry for my English if it's bad)

Thank you very much
Paul-Guillaume
Top achievements
Rank 1
 answered on 12 Aug 2014
3 answers
240 views
Hello - 

This question pertains to the usage of the destroy() method of kendo mobile view object. We have an application that starts off displaying a login screen (login-view), where a user enters username/password to view a "dashboard" screen (dashboard-view). Here is the index.html markup showing the login-view and the dashboard-view - for brevity's sake I am only showing the relevant portions of the code, and oversimplifying it.

...
...
<div data-role="view" id="login-view" data-layout="login-layout" data-init="login-init">
   <div id="login-view-content" data-role="content"></div>
</div>
 
<div data-role="view" id="dashboard-view" data-layout="default-layout" data-init="dashboard-init">
   <div id="dashboard-view-content" data-role="content"></div>
</div>
...
...
The app is initialized as:
this.kendoApp = new kendo.mobile.Application(document.body, { initial: "login-view" });
In the data-init methods of both views, we insert content into the respective content divs ("login-view-content" and "dashboard-view-content"). When the user logs out, the app navigates to the login-view. The problem we are facing is when a second (different) user logs in, the first user's content is still displaying. (Note that the data-init methods are not called for the second user since those views have already been inititalized. We tried solving this problem by destroying the dashboard view and emptying out the contents at the time of logging out:

$("#dashboard-view").data("kendoMobileView").destroy()
$("#dashboard-view-content").empty(); // also tried without this line.
On the second login, we recreated the view as:

$("#dashboard-view").kendoMobileView();
We were expecting this to fire the dashboard-init event where we could insert the second user's content, but that wasn't the case - dashboard-init never gets called again. It seems intuitive that when a view is destroyed and recreated, then the corresponding data-init should be called. Is there a mechanism in the kendo.mobile's API that could address this problem. If not, what approach should be taken in this situation as recommended by Kendo's best practices? 

Regards,
Sundar
Petyo
Telerik team
 answered on 12 Aug 2014
2 answers
215 views
Hi there,

I wonder how to add/remove shapes after the map is rendered. All of your demos for shapes layer are adding shapes during map initialize.

Thanks!
Evgeny Vdovin
Top achievements
Rank 1
 answered on 11 Aug 2014
2 answers
206 views
I have a collection of items which are databound to a Diagram.  During the "visualTemplate" method I set each item's X and Y values.  After all items have been rendered to the screen, the diagram changes all of those positions using its layout functionality.  My question is how do I disable auto layout of my items on the diagram?
Jeremiah
Top achievements
Rank 2
 answered on 11 Aug 2014
5 answers
174 views
I am running into problem, where i am not sure how to do this.
I am attempting to do Cascading Combo box inside the Grid using JQuery(No MVC). 
I will need to use it in both inline & POPUP mode.

1) How to i refresh the State & City Combo when i change the selection of Country.
   a) I also need to pass some additional data from other Column, along with selected country to webAPI method
2) I want to display CountryName, StateName & CityName in their foreign key, when not i edit mode, how can i do that.
   (during submit, i want the ID's to be submitted back to the server & not the Names)

NOTE: CountryID_FK, StateID_FK,CityID_FK are Foreign keys.

{
                     field: "CountryID_FK",
                     width: 110,
                     editor: CountiresComboEditor
                 },
                  {
                      field: "StateID_FK",
                      width: 110,
                      editor: StateComboEditor
                  },
                   {
                       field: "CityID_FK",
                       width: 110,
                       editor: CitiesComboEditor
                   }




 function CountiresComboEditor(container, options) {
                $('<input id="CountryDDL1" name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
                    autoBind: false,
                    dataSource: {
                        transport: {
                            read: {
                                url: baseURL + "/GetCountries", // <-- Get data from here
                                dataType: "json" // <-- The default was "jsonp"
                            }
                        },
                        schema: {
                            data: function (data) {
                                return data.Items; // <-- The result is just the data, it doesn't need to be unpacked.
                            }
                        }
                    },
                    dataTextField: "Name",
                    dataValueField: "CountryID_PK",
                    change: function () {
// Not sure how to refresh the State & City DDL
                        var ddlstate = $("#StateDDL").data("kendoDropDownList");
                        ddlstate .refresh();
                        var ddlcity = $("#CityDDL").data("kendoDropDownList");
                        ddlcity .refresh();
                    }
                });
            }            

            function StateComboEditor(container, options) {
                $('<input id="StateDDL" name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
                    autoBind: false,
                    dataSource: {
                        transport: {
                            read: {
                                url: baseURL + "/GetStates", // <-- Get data from here
                                dataType: "json" // <-- The default was "jsonp"
                            }
                        },
                        schema: {
                            data: function (data) {
                                return data.Items; // <-- The result is just the data, it doesn't need to be unpacked.
                            }
                        }
                    },
                    dataTextField: "Name",
                    dataValueField: "StateID_PK",
                    change: function () {
                                          
                        var ddlCity = $("#CityDDL").data("kendoDropDownList");
                        ddlCity.refresh();

                    }
                });
            }
           

            function CitiesComboEditor(container, options) {
                $('<input id="CityDDL" name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
                    autoBind: true,
                    dataSource: {
                        transport: {
                            read: {
                                url: baseURL + "/GetCities", // <-- Get data from here
                                dataType: "json" // <-- The default was "jsonp"
                            }
                        },
                        schema: {
                            data: function (data) {
                                return data.Items; // <-- The result is just the data, it doesn't need to be unpacked.
                            }
                        }
                    },
                    dataTextField: "Name",
                    dataValueField: "CityID_PK"
                });
            }
Alexander Valchev
Telerik team
 answered on 11 Aug 2014
1 answer
180 views
Currently the Diagram doesn't support containers where a node can contain child nodes and those child nodes can have connections between them.  What I have done is to use the visualTemplate method to recursively draw groups within the "parent" group and that is working well.  What I'm having an issue with is creating connections between the children with the diagram throwing an exception saying "Object or method doesn't support 'drawingContainer'".  This exception occurs when I manually create a Connection object (set its source to a group and its target to a group) and then add that Connection to the "parent" group for rendering.  Is this something that others are experiencing and how have they overcome the issue?

I can include code if that helps people.
Hristo Germanov
Telerik team
 answered on 11 Aug 2014
3 answers
189 views
Hello guys, I have been working on an application using kendo maps, and everything went smooth till I tried to publish it into an https website. My map have two layers, the first one works perfectly but the one with Bing Maps never download the tiles.

This is my code:

 @(Html.Kendo().Map()
            .Name("mapwrapper")
            .Center(0, 0)
            .Zoom(2)
            .MaxZoom(16)
            .MinZoom(6)
            .Controls(controls=> controls.Navigator(false).Zoom(zoom=>zoom.Position(MapControlPosition.TopLeft)))
            .Layers(layers =>
            {
                layers.Add()
                    .Type(MapLayerType.Tile)
                    .UrlTemplateId(Url.Action(null, "Tiles") + "?z=#= zoom #&x=#= x #&y=#= y #")
                    .Subdomains("a", "b", "c");

                layers.Add()
                   .Type(MapLayerType.Bing)
                   .ImagerySet(MapLayersImagerySet.AerialWithLabels)
                   .Key("ApeI4THhSxCEqiGhrt4bEat9QIC_gCz8XXXXXXXXXXXXXXXX").Opacity(0);

            })
                .Events(events => events
                    .PanEnd("panEnd")
                    .ZoomStart("clearCanvas")
                    .ZoomEnd("zoomEnd")
                    .Click("onMapClick")
                    .ShapeCreated("onShapeCreated")
            )

I have been inspecting the Javascript console on Chrome and shows this error:

The application was loaded over HTTPS, but ran insecure content from 'http://dev.virtualearth.net/REST/v1/Imagery/Metadata/aerialwithlabels?outpu…z8ZHbGFu2qwIDypA4lEwRnAi8a_k7MvxwD&callback=bingTileParams&_=1407503550662': this content should also be loaded over HTTPS.

It works on Internet Explorer but not on Chrome and Firefox, last versions.

Do you know how could I fix this problem?

Thanks.

Best Regards.

T. Tsonev
Telerik team
 answered on 11 Aug 2014
5 answers
382 views
Hello,
version 2013.2.716 added feature Convert Unicode characters to Entities for the editor. How do I disable it?
Alexander Popov
Telerik team
 answered on 11 Aug 2014
5 answers
2.2K+ views

Hi,

i am trying to validate input for a combobox and trying to make sure that user entered/selected value from a pre-defined list of values. I am using MVVM. I tried this in two ways.

1. Using onChange event of the combobox
     I am able to validate the input as below.
     

selectionChanged: function (e) {
        if (e.sender.value() && e.sender.selectedIndex == -1)
        {
           //how to mark the control as invalid??
        }
    }

     Problem is i am not able to mark the control as invalid so that kendo framework displays the error message. I have a required validation on this field already.

2. Using rules
$(".entryform").kendoValidator({
        rules: {
            validRoom: function (input) {
                if(input.is("[name=Room]"))
                {
                    if (input.val() && input.selectedIndex != -1)
                    {
 
                    }
                }
                return true;
            }
        }
    });
Here there is no selectedIndex.

Please help.

Alexander Valchev
Telerik team
 answered on 11 Aug 2014
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
AIPrompt
TimePicker
AICodingAssistant
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
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
Bronze
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?