or
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: { }, pageSize: 6 }, columns: $scope.gridColumns }; }; controllers.MyCtrl1.$inject = ['$scope'];/* 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); } }; }]);<div my-grid kendo-grid="grid" k-options="gridOptions"></div>options.toolbar = kendo.template("<div class='toolbar'><label for='grid-search'>Search:</label><input id='grid-search' ng-model='searchValue' /></div>");$scope.gridOptions.toolbar = kendo.template("<div class='toolbar'><label for='grid-search'>Search:</label><input id='grid-search' ng-model='searchValue' /></div>");......<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>......this.kendoApp = new kendo.mobile.Application(document.body, { initial: "login-view" });$("#dashboard-view").data("kendoMobileView").destroy()$("#dashboard-view-content").empty(); // also tried without this line.$("#dashboard-view").kendoMobileView();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?? } }$(".entryform").kendoValidator({ rules: { validRoom: function (input) { if(input.is("[name=Room]")) { if (input.val() && input.selectedIndex != -1) { } } return true; } } });