Telerik Forums
Kendo UI for jQuery Forum
2 answers
149 views
My kendo grid has first column as frozen. When I use the example in kendo to print, the first column is off.

http://docs.telerik.com/kendo-ui/web/grid/walkthrough#printing-the-grid

How can I print the grid?  Also, can I change the page to landscape when printing in IE?  Thanks.
Bertha
Top achievements
Rank 1
 answered on 09 Jan 2015
1 answer
121 views
I'm trying to add a toolbar template to my grid. If I add the toolbar in a normal js file it works fine but when trying to add this in typescript file it throws an error. It says the type is incompatible. I'm very new to typescript and not sure how to fix it.

grid = $("#grid").kendoGrid({
    dataSource: {
        data: data,
        pageSize: 10
    },
    toolbar: Handlebars.compile($('#gridSearch').html()),
    columns: [ ...
Matthew
Top achievements
Rank 1
 answered on 09 Jan 2015
1 answer
835 views
I'm having a scenario where i have a bunch of parent/child viewmodels. and i'm looking for the correct way to trigger a change event on one of the children without raising it on the parent. any way i try this, the parent object is being refreshed as well. is there a way around this behavior?
Petur Subev
Telerik team
 answered on 09 Jan 2015
1 answer
161 views
Hi,

I am trying to validate radio type fields, and it works, but with an annoying side effect from a user point of view.
When I try to submit the form without checking a radio button from a list of 10 choices, I get 10 notices that it is a required field, when it should be only 1 notice.

I use the code below for validation:
01.$(document).ready(function(){
02. 
03.           $(".edit_filling").kendoValidator({
04.              rules: {
05.                radio: function(input){
06.                  if (input.filter("[type=radio]") && input.attr("required")) {       
07.                        return $(".edit_filling").find("[data-qs=" + input.attr("data-qs") + "]").is(":checked");
08.                  }
09.                  return true;
10.                }
11.              },
12.              messages: {
13.                radio: "This is a required field"
14.              }
15.            });
16. 
17.       });

What happens without checking a radio button:

What was the make of Your first car?
1. Chevrolet This is a required field
2. Ford This is a required field
3. Mercedes This is a required field
4. BMW This is a required field
5. Ferrari This is a required field
6. Citroen This is a required field
7. Renault This is a required field
8. Seat This is a required field

What should happen:

What was the make of Your first car?
This is a required field
1. Chevrolet
2. Ford
3. Mercedes
4. BMW
5. Ferrari
6. Citroen
7. Renault
8. Seat

Please help me to solve this issue.
Georgi Krustev
Telerik team
 answered on 09 Jan 2015
2 answers
152 views
I took the following example from Tsvetomir Tsonev's post to understand how to handle multiple series with a dataSource.

In this example, I added 1 series for March and it's still working as expected.

However, when I add a 4th series for April in this example, the data isn't displayed correctly anymore... all series are getting mixed up and the seem to be rendered randomly on the chart.  Is there a bug or am I missing something about the example you provided?

Best regards,

Simon



Simon
Top achievements
Rank 1
 answered on 09 Jan 2015
1 answer
632 views
Out of the box, the ComboBox supports filter values are startswith, endswith and contains. Our requirement needs a more complex filtering mechanism. Our data source will be something looks like 
[{name: "Pennsylvania State University", id: 1}, {name: "University of Pennsylvania", id: 2}, {name: "Princeton University", id: 3}]
When user enters "penn univ", we want the filter result to be 
[{name: "Pennsylvania State University", id: 1}, {name: "University of Pennsylvania", id: 2}]
This needs a dynamically generated filter like
{ logic: "and",
  filters:[{ field: "name", operator: "contains", value: "penn"},
    { field: "name", operator: "contains", value: "univ"}
  ]
}
Is it possible for us to pass a function which returns such a filter with a dynamically generated filter array inside? Or is it has to be predefined string? If we can, how do we split the user input into string array and pass the parts in as value respectively? 
Is it possible to capture the keyup event of the input, and filter the data source separately?
Georgi Krustev
Telerik team
 answered on 09 Jan 2015
3 answers
207 views
I would like to implement a standard deviation aggregate for the entire grid as well as for individual groups.  I found this article which describes a workaround for introducing custom aggregates http://www.telerik.com/forums/how-to-do-custom-aggregate-functions.

Is following that example my best bet.  In my case I actually need to get access to the constituents of each group in order to recalculate the standard deviation.

Is there a better method for accomplishing what I need?  Has custom aggregates feature been requested and is it something you are considering implementing?

Thanks a lot.

--e 


Petur Subev
Telerik team
 answered on 09 Jan 2015
5 answers
168 views
Hello,

For a project I am working on I have a kendo grid that does server side paging. We have been able to get it to work with searching and sorting, but when we try to add in .Groupable() and drag a field to be grouped by, we just get a spinning circle with the javascript error message: 

Cannot read property 'length' of undefined

We return the type DataSourceResult from the controller, which I have noticed does not have any fields for grouping information. Should we be returning a different data type? Or perhaps we need a different approach all together?

Here is my grid:

@(Html.Kendo().Grid<UserViewModel>()
          .Name("grid")
          .DataSource(dataSource => dataSource
              .Ajax()
              .Read(read => read.Action("Read", "Users").Data("getSearchData"))
              .PageSize(20)
          )
          .Columns(columns =>
          {
              columns.Bound(o => o.UserName);
              columns.Bound(o => o.Name);
              columns.Bound(o => o.Email);
              columns.Bound(o => o.Status);
              columns.Bound(o => o.OrganizationRoles).Title("Roles");
              columns.Bound(o => o.Href)
                  .ClientTemplate("<a href=\"/Users/Edit?href=${Href}&previousPage=/Users\" data-icon=\"e\" class=\"btn btn-icon\"></a>" +
                                  "<a href=\"/Users/Delete?href=${Href}&previousPage=/Users\" data-icon=\"x\" data-Id=\"1\" class=\"btn btn-icon delete-role\"></a>")
                  .Title("Actions").Sortable(false);
          })
          .Pageable()
          .Groupable()
          .Sortable(sortable => sortable
              .Enabled(true)
              .AllowUnsort(false)
              .SortMode(GridSortMode.SingleColumn))
          .Deferred()
          )

<script>
    require(['/Content/js/config.js'], function () {
        require(['jquery', 'lib/kendo/kendo.grid.min', 'lib/kendo/kendo.aspnetmvc.min'], function ($, kendogrid, kendomvc) {
            @Html.Kendo().DeferredScriptsFor("grid", false)

            $(".k-link").bind("click", function(e) {
                $('#grid').data('kendoGrid').dataSource.page(1);
            });

            $('#SearchString').keyup(function(event) {
                if (event.keyCode == 13) {
                    $('#SearchButton').click();
                }
            });

            $("#SearchButton").click(
                function () {
                    $('#grid').data('kendoGrid').dataSource.fetch();
                    $('#grid').data('kendoGrid').dataSource.page(1);
                });

            function getSearchData() {
                // Reserved property names
                // used by DataSourceRequest: sort, page, pageSize, group, filter
                return {
                    SearchString: $("#SearchString").val(),
                    SearchTypeSelected: $("#SearchTypeSelected").val(),
                    //...
                };
            };
        });
    });

</script>


And here is the controller code:

public ActionResult Read([DataSourceRequest] DataSourceRequest request, TSearchViewModel queryModelInput)
        {
            var pagingLinks = (List<Link>)TempData["Links"];
            if (pagingLinks != null && pagingLinks.FirstOrDefault() != null && !pagingLinks.FirstOrDefault().Href.StartsWith(ListHref))
            {
                TempData["PriorGridState"] = null;
                TempData["Links"] = null;
            }
            var priorGridState = TempData["PriorGridState"] as GridState;
            var gridState = new GridState(request, queryModelInput, TempData["Links"] as List<Link>, ListHref);

            // figure out what api call needed based on how the grid has changed
            var gridComparisonResult = gridState.CompareTo(priorGridState);
            if (gridComparisonResult.GoToPageOne)
            {
                request.Page = 1;
            }
            var href = gridComparisonResult.NextHref;

            var result = GetDataResult(href, request); // may need to use extension method .ToDataSourceResult()?

            TempData["PriorGridState"] = gridState;
            return Json(result, JsonRequestBehavior.AllowGet);
        }

        public virtual DataSourceResult GetDataResult(string href, DataSourceRequest request)
        {
            if (String.IsNullOrEmpty(href))
            {
                href = ListHref;
            }

            var representation = HalClient.Get<PagedHalListViewModel<TInfoViewModel, Links>>(href);

            TempData["Links"] = representation.Links.ToList();

            var result = new DataSourceResult();
            
            try
            {
                result.Data = representation.ResourceList;
                result.Total = representation.TotalResults;
                result.Data.ToDataSourceResult(request);
            } catch (Exception)
            {
                result.Total = 0;
            }

            return result;
        }

Any recommendations of how I should proceed here? I am happy to provide any additional information you might require to answer the question. And remember, everything works except for the grouping.

Thanks,
Danny







Alexander Popov
Telerik team
 answered on 09 Jan 2015
1 answer
94 views
I've created an example that reproduces the issue some of the time. This issue does not occur all the time but seems to be related to using the mouse button and update button. Hitting enter to save seems to always work. At first I thought it was my code (validation, etc) but I've narrowed it down to a simple example that still is an example of the issue.

I've previously had hacks in place to have custom buttons that call $(document.activeElement).blur() before calling a grid update method but even that was problematic.

Dojo example: http://dojo.telerik.com/oWoBu
Screencast showing the issue: http://screencast.com/t/lsmHjMqc

In the screencast the first two attempts succeed but the third attempt shows how the data isn't saved.
Kiril Nikolov
Telerik team
 answered on 09 Jan 2015
1 answer
78 views
Hi,

I am having issues with number type field validation.
The fields have a default value of 0, and they are required, but Kendo still shows an error message when the field is not empty.

This is my number field:
<input type="number" id="someid" name="somename" value="0" min="0" max="100" required="required" validationMessage="This is a required field">


This is my js:
$(document).ready(function(){
 
           $("form").kendoValidator({
              rules: {
                radio: function(input){
                  if (input.filter("[type=radio]") && input.attr("required")) {       
                        return $(".edit_filling").find("[data-qs=" + input.attr("data-qs") + "]").is(":checked");
                  }
                  return true;
                }
              },
              messages: {
                radio: "This field is required"
              }
            });
 
       });

Ideally this should be valid even if the user doesn't touch it. Of course if he deletes the 0, or inputs a higher value than 100 then the error message should be displayed.

Please help me with this issue.

Best Wishes,
Matt
Alexander Valchev
Telerik team
 answered on 09 Jan 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?