Telerik Forums
Kendo UI for jQuery Forum
1 answer
124 views

Is there any way to set an even on click of a plotband? It would be nice if there was also a way to add a class or an id to the data elements so that you could use a jquery selector to get at any informat you are after. That would be a nice way to easily get at the elements. 
Iliana Dyankova
Telerik team
 answered on 25 Jun 2013
1 answer
12.0K+ views
Hi,
I've a menu like this
@(Html.Kendo().Menu()
      .Name("grouplist")
      .HtmlAttributes(new { style = "width: 140px;" })
      .Items(items =>
      {
            foreach (ns.Models.GroupModel item in groups)
            {
                items.Add()
                    .Text(item.Name)
                    .HtmlAttributes(new { @class = "menuitem" })
                    //.HtmlAttributes(new { @title = "Items in this group : " + item.Count })
                    .Items(children =>
                    {
                        children.Add().Text("Add new item");
                        children.Add().Text("Edit group");
                        children.Add().Text("Delete group!");
                    });
            }
        })
      .Orientation(MenuOrientation.Vertical))
All works fine if I keep commented the second HtmlAttributes (used to set the tooltip through title), if I uncomment that line, the menu show the tooltip but, uses jquery default style (and not kendo theme) and lost item css class 'menuitem'
Iliana Dyankova
Telerik team
 answered on 25 Jun 2013
1 answer
5.3K+ views
I'm trying on document.ready to call:
$("#ID_Comercial").addClass('mandatory');
But it doesn't works, the class gets added to an input shown below, but not to the actual dropdownlist, so it's not displaying the new styles :
<input id="ID_Comercial" class="mandatory" type="text" style="width: 200px; display: none;" name="ID_Comercial" data-role="dropdownlist">
How can I add a css class or remove it from an existing dropdownlist or any other kendo widget?

Thanks in advance.
Sergi
Top achievements
Rank 1
 answered on 25 Jun 2013
3 answers
826 views
I'm using the Kendo UI Web v2012.1.515 version and had a need to expand the first item in a dynamically created PanelBar (in code behind via c#). To make it more complicated, I'm working in SharePoint 2010. After sniffing around the DOM for a bit, I found a class on the first item in the panel "k-first". Since accessing the PanelBar.expand() method requires a jQuery selector, I decided to use this class as my selector...
here's the code snippet...

//pass the PanelBar into a JavaScript Object...
var ScorecardList = $("ul[jqID|='ScorecardList']=").kendoPanelBar({ });

//Show the first Item in the DisplyOrder Option List...via the k-first class...
var FirstExpand = ScorecardList.data("kendoPanelBar").expand($(".k-first"));

Disclaimer...this worked for me. This might not work in future releases, and may not work as described here. Your mileage may vary.
Alexander Valchev
Telerik team
 answered on 25 Jun 2013
1 answer
92 views
Hi,

I've just updated my version of Kendo UI to the latest commercial version.

I'm using the same application pattern as used in the Kendo Mobile Music Store (require.js, one js file per view).
I'm not sure if this has changed, but the initialisation of Application.pane now seems to occur after startup:-
$(function(){
    that.element = $(element ? element : document.body);
    that._setupPlatform();
    that._setupElementClass();
    that._attachHideBarHandlers();
    that.pane = new Pane(that.element, that.options);
    that._attachMeta();
 
    if (that.options.updateDocumentTitle) {
        that._setupDocumentTitle();
    }
 
    that._startHistory();
});
That means that anything that uses Application.pane (utils.redirect, utils.showLoading) on a "show" call from my initial view crashes thus:-

Uncaught TypeError: Cannot read property 'history' of undefined scripts/utils.js:54
  redirect  scripts/utils.js:54
Please let me know if you can help, or if I can provide further information.

Matt
Petyo
Telerik team
 answered on 25 Jun 2013
8 answers
429 views
Hi,

For drawing stacked bars chart, the labels in SeriesDefaults obeject looks mess for some data. I wanna know whether there is a way show the sum of the data of all stack data as label instead of showing data for each bar. For example, in my code, on 08/12 date, active: 24216, idle: 2030. The total of both is 26246. Can I just show this total number on top of the bar? How can I do that. Thanks.

This is my code:
http://jsfiddle.net/fAQXq/2/ 
jwize
Top achievements
Rank 1
 answered on 25 Jun 2013
0 answers
115 views
Hi there

We are using license version of KendoUI version 2012.2.913.340.
It's MVC 4 in .Net 4.5.

I have a grid on a page and it has CRUD on controller. I do get data on grid as a search result.

When I edit one of the record and try to save, I get issue on date as I see date coming to controller is : 1/01/0001 12:00:00 AM. I tried to put following code to see what the issue is and I can see issue is on line 16 where Attempted value is 6/25/2013 10:45:00 AM in place of 25/6/2013 10:45:00 AM.

FYI,
I do have web.config set to following:
<globalization culture="en-AU" uiCulture="en-AU" />
I have tried using Code first 5.0 as well as EDMX (default)
public class MyDateTimeModelBinder : DefaultModelBinder
    {
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {


            var displayFormat = bindingContext.ModelMetadata.DisplayFormatString;
            var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);

            if (!string.IsNullOrEmpty(displayFormat) && value != null)
            {
                DateTime date;
                displayFormat = displayFormat.Replace("{0:", string.Empty).Replace("}", string.Empty);
                // use the format specified in the DisplayFormat attribute to parse the date

                bindingContext.ModelState.SetModelValue(bindingContext.ModelName, bindingContext.ValueProvider.GetValue(bindingContext.ModelName));

                if (DateTime.TryParseExact(value.AttemptedValue, displayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
                {
                    return date;
                }
                else
                {
                    bindingContext.ModelState.AddModelError(
                        bindingContext.ModelName,
                        string.Format("{0} is an invalid date format", value.AttemptedValue)
                    );
                }
            }

            return base.BindModel(controllerContext, bindingContext);
        }


    }

I have created controller (on a same site), as how Microsoft does by right clicking on controller right clicking on view etc.. and it has generated CRUD which works without any issue. I mean above all line 30 works with correct date format.

Can you please tell me what I am doing wrong here.

I am in Australia and like to see en-AU culture.
ankit
Top achievements
Rank 1
 asked on 25 Jun 2013
0 answers
95 views
Hi there

We are using license version of KendoUI version 2012.2.913.340.
It's MVC 4 in .Net 4.5.

I have a grid on a page and it has CRUD on controller. I do get data on grid as a search result.

When I edit one of the record and try to save, I get issue on date as I see date coming to controller is : 1/01/0001 12:00:00 AM. I tried to put following code to see what the issue is and I can see issue is on line 16 where Attempted value is 6/25/2013 10:45:00 AM in place of 25/6/2013 10:45:00 AM.

FYI,
I do have web.config set to following:
1.<globalization culture="en-AU" uiCulture="en-AU" />
I have tried using Code first 5.0 as well as EDMX (default)
01.public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
02.        {
03. 
04. 
05.            var displayFormat = bindingContext.ModelMetadata.DisplayFormatString;
06.            var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
07. 
08.            if (!string.IsNullOrEmpty(displayFormat) && value != null)
09.            {
10.                DateTime date;
11.                displayFormat = displayFormat.Replace("{0:", string.Empty).Replace("}", string.Empty);
12.                // use the format specified in the DisplayFormat attribute to parse the date
13. 
14.                bindingContext.ModelState.SetModelValue(bindingContext.ModelName, bindingContext.ValueProvider.GetValue(bindingContext.ModelName));
15. 
16.                if (DateTime.TryParseExact(value.AttemptedValue, displayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
17.                {
18.                    return date;
19.                }
20.                else
21.                {
22.                    bindingContext.ModelState.AddModelError(
23.                        bindingContext.ModelName,
24.                        string.Format("{0} is an invalid date format", value.AttemptedValue)
25.                    );
26.                }
27.            }
28. 
29.            return base.BindModel(controllerContext, bindingContext);
30.        }
ankit
Top achievements
Rank 1
 asked on 25 Jun 2013
2 answers
387 views
Hi,

When I set DataSource to a grid datetime values are converted to string as /Date(1362607200000)/,
removing DataSource and command column works but I need command values so I should set DataSource for functions.

Works
Html.Kendo().Grid(Model)
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.CaptureRequest.Title).HtmlAttributes(new { style = "cursor:pointer" }).Title(ContentProvider.Resources.Names.Name);
        columns.Bound(p => p.CaptureRequest.StartDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.StartDate);
        columns.Bound(p => p.CaptureRequest.EndDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.EndDate);
    })
Sample output
Start Time            End Time
230.01.2013                08.02.2013

Doesn't Work
Html.Kendo().Grid(Model)
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.CaptureRequest.Title).HtmlAttributes(new { style = "cursor:pointer" }).Title(ContentProvider.Resources.Names.Name);
        columns.Bound(p => p.CaptureRequest.StartDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.StartDate);
        columns.Bound(p => p.CaptureRequest.EndDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.EndDate);
        columns.Command(command => command.Destroy()).Width(90);
    })
.DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Events(events =>
        {
            events.Error("onGridError");
            events.RequestEnd("onGridRequestEnd");
        })
        .Model(model =>
        {
            model.Id(p => p.CaptureRequest.ID);
        })
        .Read(read => read.Action("RequestGridSource/" + @ViewBag.id, "TstvOperation"))
        .Destroy(update => update.Action("DeleteActiveCaptureRequest", "TstvOperation"))
    )
Sample output
Start Time                        End Time
/Date(1359038400000)/          /Date(1359044400000)/

What should be done to keep datetime values with formatting?

Thanks
Evan
Top achievements
Rank 1
 answered on 24 Jun 2013
3 answers
194 views
Hi,

I am trying to listen to a swipe event across my entire Kendo mobile application. My best attempt is as follows:

$(document.body).kendoTouch({
    enableSwipe: true,
    minXDelta: 20,
    swipe: function(e) {
        console.log("swipe " + e.direction);
        alert("swipe " + e.direction);
        if(e.direction == "right") {
            if(app.pane.history.length > 1){
                app.navigate("#:back");
            }
        }
    }
});

This works in the graphite simulator and on android devices. However, on an iPhone the event is only fired on the initial view before navigating anywhere. After navigating to another view it no longer fires, even when returning to the initial view. I figure the event handler is dropped after the DOM is modified but it's hard to debug on the iPhone.

I did get this working by rebinding this event handler to the body every time the application viewShow event fired, but this didn't seem right and I think I noticed a hit to performance.

Is this a bug with Kendo mobile or is there a better way to go about this? I want to avoid having to wire up each of my views individually if possible.

Regards
Dean
Kiril Nikolov
Telerik team
 answered on 24 Jun 2013
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
Drag and Drop
Application
Map
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
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?