Telerik Forums
Kendo UI for jQuery Forum
4 answers
551 views
Hi,

When a form loads we want to highlight which fields are required fields by changing the colour of the label.  If you look at the attached image SoureRequiredAuthorNotRequired.PNG you can see the Source field is highlighted in red as it is a required field.  When a value is entered for the Source the red highlighting disappears.

To do this we have used:

<div class="form-group" ng-class="{'has-error' : editForm.Source.$error.required}">
    <label for="Source" class="control-label required">Source</label>
    <input type="text" id="Source" name="Source" ng-model="vm.data.record.source" class="form-control input" required />
</div>
 
<div class="form-group">
    <label for="Author" class="control-label">Author</label>
    <input type="text" id="Author" name="Author" ng-model="vm.data.record.author" class="form-control input" />
</div>

We have now added in a Kendo date picker and hoped this would work in the same way:

<div class="form-group" ng-class="{'has-error' : editForm.PressCuttingDate.$error.required}">
    <label for="PressCuttingDate" class="control-label required">Date</label>
    <input type="date" kendo-date-picker id="PressCuttingDate" name="PressCuttingDate" k-ng-model="vm.data.record.pressCuttingDate" k-format="'dd/MM/yyyy'" style="width: 100%" required />
</div>
 
<div class="form-group" ng-class="{'has-error' : editForm.Source.$error.required}">
    <label for="Source" class="control-label required">Source</label>
    <input type="text" id="Source" name="Source" ng-model="vm.data.record.source" class="form-control input" required />
</div>
 
<div class="form-group">
    <label for="Author" class="control-label">Author</label>
    <input type="text" id="Author" name="Author" ng-model="vm.data.record.author" class="form-control input" />
</div>

Unfortulately this does not work.  It seems that to validate a kendo date picker you have to use the kendo validator.  Is that correct?

Assuming that is correct, we added the following code:

<form name="editForm" novalidate kendo-validator="vm.formValidation">

to use the kendo validator.  Looking at the documentation you have a validateInput function which validates just one field:

http://docs.telerik.com/kendo-ui/api/javascript/ui/validator#methods-validateInput

We then tried:

<div class="form-group" ng-class="{'has-error' : vm.formValidation.validateInput($('input[name=PressCuttingDate]')) }">
    <label for="PressCuttingDate" class="control-label required">Date</label>
    <input type="date" kendo-date-picker id="PressCuttingDate" name="PressCuttingDate" k-ng-model="vm.data.record.pressCuttingDate" k-format="'dd/MM/yyyy'" style="width: 100%" required />
</div>

Which did not work.  validateInput only seems to work if it used as part of a button click.  Is this correct?

How can I get this to work so that the red highlighting appears when nothing has been entered and disappears when a value has been entered (without the user clicking on a save button etc)?

Many thanks
Petyo
Telerik team
 answered on 16 Sep 2014
7 answers
220 views
Is there a way to change the relative position of a donut chart's tooltip?

If my chart is close to the edge of my RadDock, the tooltip is chopped off or I get an unsightly scrollbar.  I am attaching a screenshot and pasting an example of the undesired behavior:

Thank you,
Anthony

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html >
<html>
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
    <style>
        .appboundary {
            padding: 10px;
            width: 100%-40px;
            height: 100%;
            background-color: #fff;
            margin: 20px;
            -moz-box-shadow: 0 0 0 4px #FFF, inset 1px 0px 10px #C3C4C7, 0px 1px 6px 6px rgba(10,0,0,.5);
            -webkit-box-shadow: 0 0 0 4px #FFF, inset 1px 0px 10px #C3C4C7, 0px 1px 6px 6px rgba(10,0,0,.5);
            box-shadow: 0 0 0 4px #FFF, inset 1px 0px 10px #C3C4C7, 0px 1px 6px 6px rgba(10,0,0,.5);
            -webkit-border-radius: 1px;
            -moz-border-radius: 1px;
            border-radius: 1px;
        }
    </style>
</head>
<body>
 
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <script src="http://cdn.kendostatic.com/2013.1.319/js/kendo.all.min.js"></script>
        <script>
            function createChart() {
                $("#donutholder").kendoChart({
                    title: {
                        visible: false
                    },
                    legend: {
                        visible: false
                    },
                    chartArea: {
                        background: "",
                        height: 180,
                        width: 180
                    },
                    seriesDefaults: {
                        type: "donut",
                        startAngle: 90,
                        holeSize: 60,
                        size: 20,
                        overlay: {
                            gradient: "sharpBevel"
                        }
                    },
                    series: [
                        {
                            data: [
                                {
                                    category: "Promoted",
                                    value: 2,
                                    color: "#931d2f"
                                },
                                {
                                    category: "Failed Attempts",
                                    value: 1,
                                    color: "#e4a612"
                                }
                            ],
                            labels: {
                                visible: false,
                                background: "transparent",
                                position: "outsideEnd",
                                template: "#= category #: #= value#%"
                            }
                        }
                    ],
                    tooltip: {
                        visible: true,
                        template: "#= category #: #= value#"
                    }
                });
            }
 
            $(document).ready(function () {
                setTimeout(function () {
                    createChart();
                }, 400);
            });
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <div>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                <telerik:RadDockLayout runat="server" ID="RadDockLayout1">
                    <telerik:RadDockZone ID="RadDockZone1" runat="server" CssClass="appboundary" FitDocks="True" BorderStyle="None"
                        Style="max-width: 1200px">
                        <telerik:RadDock runat="server" ID="RadDock1" DefaultCommands="ExpandCollapse"
                            DockMode="Docked" EnableDrag="False" EnableAnimation="True">
                            <ContentTemplate>
                                <div style="float: right" id="donutholder">
                                </div>
                            </ContentTemplate>
                        </telerik:RadDock>
                    </telerik:RadDockZone>
                </telerik:RadDockLayout>
            </telerik:RadAjaxPanel>
        </div>
    </form>
</body>
</html>


Jo
Top achievements
Rank 1
 answered on 16 Sep 2014
3 answers
193 views
Hello.  I'm trying to talk to a Rails app using REST & json. I'm having problem passing custom group parameter. I tried various different hacks but nothing seems to work. Here my code ( I made it as simple as possible to make sure it run and I'm still getting an error)


The service I'm passing params to requires them to be passed like so:  
http://localhost/products/search?page=1&per=10&group_by=manufacturer_id+asc&order_by=vendor_id+asc,vendor_number+desc

Sorting (order_by) - works fine. But grouping causes an error: Uncaught TypeError: undefined is not a function  

Here is my code:




crudServiceBaseUrl = "/products";

productsDataSource = new kendo.data.DataSource({
  autoSync: true,
  pageSize: 10,
  serverPaging: true,
  serverSorting: true,
  serverGrouping: true,
  schema: {
    data: "products",
    total: "count"
  },
  batch: false,
  transport: {
    read: {
      url: crudServiceBaseUrl + "/search",
      dataType: "json",
      contentType: "application/json",
      type: "GET"
    },
    update: {
      url: function(expense) {
        return crudServiceBaseUrl + "/" + expense.id;
      },
      dataType: "json",
      contentType: "application/json",
      type: "PUT"
    },
    destroy: {
      url: function(expense) {
        return crudServiceBaseUrl + "/" + expense.id;
      },
      dataType: "json",
      type: "DELETE"
    },
    create: {
      url: crudServiceBaseUrl,
      dataType: "json",
      contentType: "application/json",
      type: "POST"
    },
    parameterMap: function(data, type) {
      if (type === "read") {
        return {
          page: data.page,
          per: data.pageSize,
          group_by: function() {
            var groupings;
            if (typeof data.group === "undefined") {
              return "";
            } else {
              groupings = $.makeArray(data.group);
              return $.map(groupings, function(g) {
                return g.field + " " + g.dir;
              }).join(",");
            }
          },
          order_by: function() {
            var sortings;
            if (typeof data.sort === "undefined") {
              return "";
            } else {
              sortings = $.makeArray(data.sort);
              return $.map(sortings, function(s) {
                return s.field + " " + s.dir;
              }).join(",");
            }
          }
        };
      }
    }
  }
});

products_grid = $("#products_grid").kendoGrid({
  dataSource: productsDataSource,
  groupable: true,
  sortable: {
    mode: "multiple",
    allowUnsort: true
  },
  pageable: true
});

Nick
Top achievements
Rank 1
 answered on 15 Sep 2014
3 answers
1.4K+ views
Hy,

I've got a Column with DateTime Values! eg.: "2014/09/11 10:00"

Our Customer wants to filter the Column by Datepicker and only one field (filterable.extra: false) - so if I add a Datepicker Filter (not DateTimepicker) and wanna filter "is equal" to "2014/09/11" the Grid don't wanna display anything - Problem ist that the filtered Date is "2014/09/11 00:00", whicht isn't equal because of the time - how can I fix this issue?

In the Column I have to display the date with the time, filtering should ignore the time!

greetings from Austria
Flo
Kiril Nikolov
Telerik team
 answered on 15 Sep 2014
4 answers
170 views
I tried updating my grid to use 2014.2.903 version of kendo.min.js and kendo.angular.min.js, but when I do, code that was working formerly no longer works.

Specifically this snippet in the initialization of grid columns is where I get an error:

filterable: {
extra: false,
cell: {
template: function (input) {
input.kendoDropDownList({

It complains that kendoDropDownList is not something that can be done to "input". Type of input shows as Object, or if you look further into the properties it is correctly identified as an INPUT.

Putting back the former *.js files returned my app to working as before.

Bob Graham

Alexander Popov
Telerik team
 answered on 15 Sep 2014
1 answer
243 views
Hello
I have following data:

user_id, user_first_name, user_surname, some_other_data

On Grid I'm displaying it in following way

UserDisplayName (user_first_name + ' '+ user_surname), Some Data

Now I would like to group data by user. So in fact on database level it should be grouped by user id but then it should display in grid group header proper user display name.

I know how to achieve such grouping by simply replacing proper memeber in group descriptor on DataSourceRequest object, but Then group header is wrong.
Probably it would be possible to somehow on fly replace that values?

But I believe it would be still a problem with sorting.

Is such server grouping is possible? In linq I can define multiple columns to group, but have no idea how to apply that to data source.

Kind Regards
Marcin
Alexander Popov
Telerik team
 answered on 15 Sep 2014
5 answers
363 views
I want to have a 'begin --> end' date range show when date columns are filtered.

This code snippet works, the first time the filter is opened:
...,
filterMenuInit: function (e) {  
            if (e.field === "DateRequested") {
                var beginOperator = e.container.find("[data-role=dropdownlist]:eq(0)").data("kendoDropDownList");
                beginOperator.value("gte");
                beginOperator.trigger("change");
 
                var endOperator = e.container.find("[data-role=dropdownlist]:eq(2)").data("kendoDropDownList");
                endOperator.value("lte");
                endOperator.trigger("change");
            }
        },
...

However, the next time it is opened, the gte option is shown for both the zero-eth and the 2nd operators. The filterMenuInit is never hit again. How can I make it persist?

Thanks, Bob Graham
Daniel
Telerik team
 answered on 15 Sep 2014
5 answers
1.2K+ views
hello,
the datasource is a valid json but i can't get the grid to display the data (see below).
am i doing something wrong  or is it not supposed to work?
thankful for any Help!
viktor

var dataSet = [
 {
"Id": "datatests/57238",
"Name": "11hacAMT02",  
"Total|Fam": 96,
"Total|Mean": 2.4,
"Total|N1": 21,
"Total|TixP": 57,
"Filter Like|Var": 1.1,
"Age__25-29_Fam":89
 },
];
var layout =  [
{
field: "Name",
title: "Name"
},  
{
field: "Total|N1", //Uncaught ReferenceError: Total is not defined
title: "Total<br>N1"
},
{
field: "Filter Like|Var", //Uncaught Error: Invalid template
title: "Filter Like<br>Var"
},
{
 field: "Age__25-29_Fam", //Uncaught Error: Invalid template 
 title: "Age 25-29<br>Fam"
}
];
var localDataSource = new kendo.data.DataSource({ data: dataSet });
$("#grid").kendoGrid({
dataSource: localDataSource,
columns:layout                    
});
Alex Gyoshev
Telerik team
 answered on 15 Sep 2014
3 answers
126 views
{ text: "Highlight Error", value: ".hlError" }

This changes:

<p>Some text</p>

to

<p><span>Some text</span></p>

How can this be changed so the output is:

<p class="hlError">Some text</p>

This is also needed for adding classes to images etc.

Many thanks

Alex Gyoshev
Telerik team
 answered on 15 Sep 2014
2 answers
297 views
Hi,

I have a div that contain some text exemple

Car1
Car2
Car3

I have another div with a scroll that contain race and the element inside are horizontal.

So you can have like 30 races

When I want to drag the Car in the second div of the race I want to find a way for the scrollbar to scroll automatically so I can go to the last race and drop my element there.

Any idea ?
Alexander Valchev
Telerik team
 answered on 15 Sep 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
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
ScrollView
Switch
TextArea
BulletChart
Licensing
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
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?