Hello,
I am planning to add an All-Columns-Grid filtering option. The grid contains multi-type columns, like string, numeric, and date data types.
I could add a TextBox inside the Toolbar, however, to implement the filtering, I might add several filters one for each column in the Grid, casting the value entered to each column's data type. Would that be a viable solution?
On the other hand, is there an out of the box solution for the above?
Best regards
Bilal
I've got a page that can be viewed in either a grouped or ungrouped view. I've attached screenshots of the two different views, for clarity.
In both views, each tile is a course, which may or may not have a tag. In the grouped view, each course needs to be grouped under it's associated tag (with a group at the bottom for all untagged courses).
Here's a sample of my template and associated function:
<script id="tile_template" type="text/x-kendo-template"> # if (data.GroupBy == 'Category') { # <!--- loop over the tags to create the headers ---> <div class="list-items-group-content-area ui-layout-west k-widget k-listview"> <div class="list-items-content-area-heading padding k-block"> <h2>Group Header</h2> </div> <!--- then for each tag, loop over the courses, seeing if their tag value matches the parent, and if so, create the tile ---> # } # <div class="col-xs-12 col-md-6 col-lg-4 course-content"> <div class="k-block list-items"> <div class="course-type"> <i class="fa-icon-desktop"></i> </div> <div class="list-items-heading padding k-block"> <div class="list-items-heading-icons"> <a data-role="button" class="k-button info-button" role="button" aria-disabled="false" tabindex="0"> <i class="fa-icon-info-circle"></i> </a> </div> <div class="list-items-heading-ellipsis"> <a> <h3 class="item-title">#= data.Name #</h3> </a> </div> </div> <div class="padding list-items-body"> <div class="tile-img"> # if (data.Tag.length > 0) { # <div class="tag-overlay"><i class="fa-icon-tag"></i>#= data.Tag #</div> # } # <img src="/image/#= data.Image #" class="img-responsive border-radius" /> </div> # if (data.Due.length > 0) { # <div class="date-overlay"> #= kendo.toString(kendo.parseDate(data.Due), 'dd-MMM-yyyy') # </div> # } # <div class="progress-bar-div"> <input type="hidden" class="progress_value" value="#= data.Progress #"> <div class="progress-bar k-widget k-progressbar k-progressbar-horizontal" data-role="progressbar"> <div class="k-state-selected" style="width:#= data.Progress #%;"> <span class="k-progress-status-wrap" style="width: 100%;"><span class="k-progress-status">#= data.Progress #%</span></span> </div> </div> </div> </div> <div class="padding list-items-footer k-block"> <a href="/launchcourse/index.cfm" class="btn btn-success"> <i class="fa-icon-play"></i> <span class="hidden-xs">Continue</span> </a> </div> </div> </div> # if (data.GroupBy == 'Category') { # </div> # } #</script>
function generateCourseView() { var template_html = $('#tile_template').html(); var course_data = {}; var template = kendo.template(template_html, {useWithBlock:false}); var no_records_template = kendo.template($('#no_records_template').html()); var datasource = new kendo.data.DataSource({ transport: { read: { type: "GET", url: "/Controllers/MainController.cfc?method=getCourses", processData: true, dataType: "json" } }, schema : { type: "json", data: "Courses" } }); datasource.bind("change", function() { var view = datasource.view(); var html = ""; if (view.length) { //courses, render the tile template html = kendo.render(function(data) { return template($.extend(data, {GroupBy: group_by})); }, view); } else { //no courses, render the "no data" template html = no_records_template({}); } $('#tile_display').html(html); }); datasource.read(); }And the JSON returned from the function:
{"Courses":[{"Due":"07\/15\/2015","Tag":"test","Name":"Enrolled (All Tasks)","Grade":"","Progress":29.0,"Image":"","ID":501292},{"Due":"10\/14\/2015","Tag":"","Name":"Enrolled (Expired Subscription)","Grade":"","Progress":0.0,"Image":"","ID":501386,},{"Due":"10\/14\/2015","Tag":"second tag","Name":"Enrolled (Expired Subscription)","Grade":"",Progress":0.0,"Image":"","ID":501385}]}So for each course I know the Tag they need to be displayed under, but I don't have the full list of tags to loop over and create the groups. And since I can't add a "Tags":[{}] section to the JSON returned from the function that populates the datasource, I'm at a bit of a loss as to how to accomplish this.
I thought I might be able to use the solution provided to my last question (http://www.telerik.com/forums/pass-value-to-template-w-o-datasource), but that was adding a simple string to the datasource, not a full complex object. I'm also unsure how to structure that, even if it's possible - if the view is supposed to be grouped, do an AJAX call to get the tags and then append them to the datasource? How do I handle the render, since the call would (sometimes) be asynchronous? How would I access the tags in the template? data.Tags.Name?
Any help you can provide would be appreciated, even if it's telling me I'm going in the complete wrong direction :)
Hi,
I have kendo UI schedule where events have been set from a data source. when I remove events from the scheduler following error has shown in console.
Uncaught TypeError: Cannot read property '$destroy' of undefinedplease find below scheduler configuration
$scope.schedulerTimeLineOptions = { date: new Date(), majorTick: 1440, minorTickCount: 1, editable: { template: $("#editor").html(), confirmation: "Are you sure you want to delete this event?" }, views: [ "timelineWeek", { type: "timelineWeek", selected: true, dateHeaderTemplate: "<span class='k-link k-nav-day'>#=kendo.toString(date, ' dd/M ddd')#</span>" }, ], edit: schedulerDialyCalendarTimeLine_edit, add: schedulerDialyCalendarTimeLine_add, save: schedulerDialyCalendarTimeLine_save, remove: schedulerDialyCalendarTimeLine_remove, timezone: "Etc/UTC", dataBound: function (e) { var view = this.view(); if (view.name.indexOf("timeline") > -1) { view.datesHeader.find("tr:last").prev().hide(); view.timesHeader.find("tr:last").prev().hide(); }; var scheduler = this; view.table.find("td[role=gridcell]").each(function () { var element = $(this); var slot = scheduler.slotByElement(element); if (slot.startDate.getDay() == 0) { element.removeClass("k-nonwork-hour"); element.addClass("scheduler-sunday"); } else if (slot.startDate.getDay() == 6) { element.removeClass("k-nonwork-hour"); element.addClass("scheduler-saturday"); } }); }, eventTemplate: "<div class='k-event-template'>#if (data.image) {# <img src='#= image #'>#}# #= title #</div>", group: { resources: ["Priests"], orientation: "vertical" }, resources: [ { field: "priest", name: "Priests", dataSource: $filter('orderBy')($scope.ActivePriestList, 'OrderIndex'), multiple: true, title: "Priests" }, { field: "color", dataColorField: "color", dataValueField: "color", dataSource: $scope.ActiveLabelList.concat($scope.MedarbeiderenLabelList) } ], navigate: function (e) { $scope.schedulerTimeLine_navigate(e, { Id: newValue, PriestList: $scope.ActivePriestList }); }};Events have been added as below
angular.forEach(resp.WorkPlanElements, function (WorkPlanElement) { angular.forEach(cacheData.get('AllLabels'), function (Label) { if(Label.Id===WorkPlanElement.LabelId){ var WorkPlanElementItem={ Id:WorkPlanElement.Id, image : "", priest: WorkPlanElement.PriestId, start: new Date(DateUtilsService.JSONdateToString_yyyyMMdd(WorkPlanElement.Start)), end: new Date(DateUtilsService.JSONdateToString_yyyyMMdd(WorkPlanElement.End)), title:Label.Name, isAllDay: true, color: "#" + Label.ColorCode.substr( 3, Label.ColorCode.length), colorItem:{ Id:Label.Id, name:Label.Name, hex: "#" + Label.ColorCode.substr( 3, Label.ColorCode.length) }, state:"Planned", duration:DateUtilsService.dateDiff(WorkPlanElement.Start, WorkPlanElement.End), comment:WorkPlanElement.Comment }; WorkPlanElementList.push(WorkPlanElementItem); }; }); });var scheduler = $("#schedulerTimeLine").data("kendoScheduler");var dataSource = new kendo.data.SchedulerDataSource({ data: WorkPlanElementList});if (!angular.isUndefined(scheduler)){ scheduler.setDataSource(dataSource); $scope.CurrentElements = WorkPlanElementList;};
please help...!!!
Thanks,
Lilan
In my app a have a ListView with an MVVM bound DataSource. Before navigating to any view I call app.showLoading() and on every view's afterShow event I call app.hideLoading(). The problem is only on the first visit to every view hideLoading() is being triggered by the listview or its datasource so my app's loading indicator is quickly dismissed and only hidden on afterShow for subsequent visits to a view. I have hooked into the datasource requestStart, requestEnd, change, and progress events as well as the listview dataBinding and dataBound events and have found instances of e.sender._itemBinder._progressHandler = function (){e.showLoading()} and e.sender._events._progress = function (){e.showLoading()} but cannot figure out how to disable hideLoading.
How do you disable app.hideLoading for ListView and/or DataSource binding?
http://docs.telerik.com/kendo-ui/api/javascript/mobile/application#methods-hideLoading
Hi all,
I've just started using Kendo UI in an AngularJS application, specifically the scheduler component, but I've run into issues trying to get dropdownlist elements to produce an onChange event when the selected item in the list is changed. I have 3 dropdownlists (Work, Category and Job) in a custom event editing template that I've created for a Scheduler. Each time a user selects a new option from the Work list, I need the options available in the Category and Job lists to be filtered based on the newly selected Work.
I've tried multiple ways of doing this and at one point I was able to get events being triggered and the lists filtering by changing some of the HTML for the dropdownlists but unfortunately doing this would then stop the selected options in the dropdowns from being bound to the currently selected event in the scheduler that I'm attempting to create/edit.
Here's the code that I have at the moment, any help would be greatly appreciated :)
Controller:
angular.module('app.view1', ['ngMaterial','kendo.directives']) .controller('View1Ctrl', function($scope, $mdSidenav, dataFieldsService, authService) { $scope.openLeftMenu = function() { $mdSidenav('left').toggle(); }; $scope.allEmployees = [ { text: "Alex", value: 1, color: "#f8a398" }, { text: "Bob", value: 2, color: "#51a0ed" }, { text: "Charlie", value: 3, color: "#56ca85" } ] $scope.allWorkFields = dataFieldsService.getWorkFields(); //$scope.selectedWork = dataFieldsService.getDefaultWork(); $scope.allCategoryFields = dataFieldsService.getCategoryFields(); $scope.allJobFields = dataFieldsService.getJobFields(); $scope.filteredCategoryFields = dataFieldsService.getFilteredCategoryFields(2748); $scope.filteredJobFields = dataFieldsService.getFilteredJobFields(2748); $scope.onWorkSelect = function(e){ var i = this.dataItem(e.item); $scope.selectedWork = {text: i.text, value: i.value, color: i.color }; $scope.filteredCategoryFields = dataFieldsService.getFilteredCategoryFields($scope.selectedWork.value); $scope.filteredJobFields = dataFieldsService.getFilteredJobFields($scope.selectedWork.value); } $scope.onEmployeeSelect = function(){ } $scope.monthPickerConfig = { start : "year", depth : "month", format : "dd MMMM yyyy" }; $scope.onDateSelected = function(e) { var datePicker = e.sender; console.log(datePicker.value()); }; $scope.onChange = function(e){ console.log("CHNAGE"); } $scope.schedulerOptions = { date: new Date(), height: "100%", views: [ { type: "day", dateHeaderTemplate: kendo.template("<strong>#=kendo.toString(date, 'd/M')#</strong>")}, { type: "week", selected: true, dateHeaderTemplate: kendo.template("<strong>#=kendo.toString(date, 'd/M')#</strong>")}, "month", "agenda", "timeline" ], editable: { template: $("#customEditorTemplate").html() }, dataBound: function(e) { console.log("dataBound"); }, timezone: "Etc/UTC", dataSource: { batch: true, transport: { read: { url: "urlToApi.json", dataType: "json", type: "GET", beforeSend: function (req) { req.setRequestHeader('Authorization', 'Basic ' + Base64.encode( authService.getUserKey() + ":" + authService.getToken())); } }, update: { dataType: "jsonp" }, create: { dataType: "jsonp" }, destroy: { dataType: "jsonp" }, parameterMap: function(options, type) { if (type === 'read') { return { 'from_date': '20150501', 'to_date': '20150531' }; } } }, schema: { model: { id: "taskId", fields: { taskId: { from: "time_segment_key", type: "number" }, employee_key: { from: "employee_key", type: "number" }, employee: { from: "employee" }, title: { from: "work" }, start: { type: "date", from: "start_time" }, end: { type: "date", from: "end_time" }, startTimezone: { from: "StartTimezone" }, endTimezone: { from: "EndTimezone" }, description: { from: "description" }, work_key: { from: "work_key", validation: { required: true } }, //work_category_key: { from: "work_category_key" }, //work_category: { from: "work_category" }, //job_key: { from: "job_key" }, //job: { from: "job" }, time_duration: {from: "duration", type: "number" }, break_duration: {from: "break_duration", type: "number" }, approved: { from: "approved", type: "boolean" }, billed: { from: "billed", type: "boolean" }, paid: { from: "paid", type: "boolean" }, work: { from: "work_key" }, category: { from: "work_category_key" }, job: { from: "job_key "} } } } }, resources: [ { field: "work", title: "Work", dataSource: $scope.allWorkFields }, { field: "category", title: "Category", dataSource: $scope.allCategoryFields }, { field: "job", title: "Job", dataSource: $scope.allJobFields } ], edit: function(e) { var workDropDown = e.container.find("#workDropDown").data("kendoDropDownList"); var categoryDropDown = e.container.find("#categoryDropDown").data("kendoDropDownList"); var jobDropDown = e.container.find("#jobDropDown").data("kendoDropDownList"); workDropDown.dataSource.data(e.sender.resources[0].dataSource.data()); categoryDropDown.dataSource.data(e.sender.resources[1].dataSource.data()); jobDropDown.dataSource.data(e.sender.resources[2].dataSource.data()); //console.log(e.event); ///* ACTION: ADD custom button */ //var newButton = $('<a class="k-button" href="#">New button</a>'); // ////wire its click event //newButton.click(function(e) { alert("Clicked"); }); // ////add the button to the container //var buttonsContainer = container.find(".k-edit-buttons"); //buttonsContainer.append(newButton); //var ownerId = e.container.find("#ownerId").data("kendoDropDownList"); //ownerId.dataSource.data(e.sender.resources[0].dataSource.data()); } }; });
HTML:
<div layout="column" layout-fill> <md-tabs md-selected="selectedIndex" class="md-primary md-hue-3" flex> <md-tab label="Timesheet"> <md-content id="scheduler" kendo-scheduler="sched" k-options="schedulerOptions" > <span k-event-template class='custom-event'>{{dataItem.title}}</span> <div k-all-day-event-template class='custom-all-day-event'>{{dataItem.title}}</div> </md-content> </md-tab> <md-tab label="Time Summary"> <section layout-margin> <md-sidenav md-component-id="left" class="md-sidenav-left md-whiteframe-z2"> <md-content> Hello World </md-content> </md-sidenav> <md-content> <md-button class="md-raised md-primary" ng-click="openLeftMenu()"> Open Left Menu </md-button> </md-content> </section> </md-tab> </md-tabs></div><script id="customEditorTemplate" type="text/x-kendo-template"> <div class="k-edit-label"><label>Employee</label></div> <div class="k-edit-field"> <input kendo-drop-down-list k-select="onEmployeeSelect" k-data-source="allEmployees" k-data-text-field="'text'"/> </div> <div class="k-edit-label"> <label for="work">Work</label> </div> <div data-container-for="work" class="k-edit-field"> <select id="workDropDown" data-bind="value:work" data-role="dropdownlist" data-value-field="value" data-text-field="text"> </select> </div> <!--<div class="k-edit-label">--> <!--<label>Work</label>--> <!--</div>--> <!--<div class="k-edit-field">--> <!--<input kendo-drop-down-list id="workDropDown" k-data-text-field="'text'">--> <!--</div>--> <div class="k-edit-label"> <label for="category">Category</label> </div> <div data-container-for="category" class="k-edit-field"> <select id="categoryDropDown" data-bind="value:category" data-role="dropdownlist" data-value-field="value" data-text-field="text"> </select> </div> <div class="k-edit-label"> <label for="job">Job</label> </div> <div data-container-for="job" class="k-edit-field"> <select id="jobDropDown" data-bind="value:job" data-role="dropdownlist" data-value-field="value" data-text-field="text"> </select> </div> <div class="k-edit-label"> <label for="start">Start</label> </div> <div data-container-for="start" class="k-edit-field"> <input type="text" data-role="datetimepicker" data-interval="15" data-type="date" data-bind="value:start,invisible:isAllDay" name="start"/> <input type="text" data-type="date" data-role="datepicker" data-bind="value:start,visible:isAllDay" name="start" /> <span data-bind="text: startTimezone"></span> <span data-for="start" class="k-invalid-msg" style="display: none;"></span> </div> <div class="k-edit-label"><label for="end">End</label></div> <div data-container-for="end" class="k-edit-field"> <input type="text" data-type="date" data-role="datetimepicker" data-bind="value:end,invisible:isAllDay" name="end" data-datecompare-msg="End date should be greater than or equal to the start date" /> <input type="text" data-type="date" data-role="datepicker" data-bind="value:end,visible:isAllDay" name="end" data-datecompare-msg="End date should be greater than or equal to the start date" /> <span data-bind="text: endTimezone"></span> <span data-bind="text: startTimezone, invisible: endTimezone"></span> <span data-for="end" class="k-invalid-msg" style="display: none;"></span> </div> <div class="k-edit-label"><label for="recurrenceRule">Repeat</label></div> <div data-container-for="recurrenceRule" class="k-edit-field"> <div data-bind="value:recurrenceRule" name="recurrenceRule" data-role="recurrenceeditor"></div> </div> <div class="k-edit-label"><label for="description">Description</label></div> <div data-container-for="description" class="k-edit-field"> <textarea name="description" class="k-textbox" data-bind="value:description"></textarea> </div></script>I can change any title of a panel like this
//var li = panelbar.wrapper.find("> li:first span.k-link.k-header");
var li = panelbar.wrapper.find("> li:nth(1) span.k-link.k-header");
li.contents().first().replaceWith("New Name");
But it does not work if the paenlBar contains this a .Content(@<text> </text>); in the parent panel bars.
@(Html.Kendo().PanelBar()
.Name("panelbar")
.Items(panelbar =>
{
panelbar.Add().Text("First Person")
.Content(@<text>
@Html.TextBoxFor(m => m.firstName, new { @class = "input k-textbox"})
</text>);
})
)
Why is this?
Thanks
Input keyup event operations inside dataitem.set method will lead to input loses focus.
The code is below:
keyupHandler: function(e){ var _id = e.target.name; var _configItemValue = e.target.value; var dataItem = that.options.dataSource.get( _id ); // above focus is ok dataItem.set( "configItemValue", _configItemValue ); // input focus lost // I had hoped to focus way in this focus, but has no effect $(e.target).focus();}
HTML Code:
<input class="k-textbox" data-bind="events: { keyup: keyupHandler}" />how to avoid this problem?
Hi there,
I am trying to test some example code that I have found and one of these samples clears the selection if a grid has detail sections, so only one line is highlighted at a time.
The example is below..
function onRowSelect(e) {
var selected = this.select();
$('.k-grid tbody>.k-state-selected').not(selected).removeClass('k-state-selected')
}
and on the grid using
.Events(e => e.Change("onRowSelect()"))
I am using MVC and the latest builds (trials).
I get the error when the page loads Uncaught TypeError: this.select is not a function
Can anyone point me to why this error is occurring?
Regards
Jason