Telerik Forums
Kendo UI for jQuery Forum
1 answer
128 views
Hello Again =),

I have an issue, I am calculating some fields, and the first time when I load the page with the cache clean, it displays this calculated fields correctly, This is a DateTimePicker inside a Kendo Grid. So when the user click s it we want it to display in an specific format, but after the page has been reloaded or refresh or we go back to the same page,  the format of the date is not respected anymore. Do you have any ideas why is this issue created.

Here is my code"

//New WO to schedule grid
    workOrdersSchedulingDataSource = new kendo.data.DataSource({
        transport: {
            read: {
                // the remote service url
                url: '/sdata/api/dynamic/-/WorkOrders?where=(Status eq \'Unassigned\')&include=Customer,AssignedTo&count=200'
            }
        },
        type: 'sdata',
        serverSorting: true,
        sort: { field: "Priority", dir: "desc" },   
        schema: { data: "$resources",
            model: {
                fields: {$key: { editable: false, defaultValue: "00000000-0000-0000-0000-000000000000" },
                    Priority: { editable: false, nullable: true },
                    Customer: { editable: false, nullable: true },
                    LocationCity: { editable: false, nullable: true },
                    ServiceDate: { editable: true, nullable: true, type: "date" }, // This is the ones I care about
                    ServiceEndDate: { editable: true, nullable: true, type: "date" }, // This is the ones I care about
                    AssignedTo: { editable: true, nullable: true }
                }
            },
            parse: function (data) {
                $.each(data.$resources, function(idx, item) {
                    if (item.AssignedTo == null) {
                        item.AssignedTo = { $key: "", FirstName: "", LastName: ""} ;
                    }
                });
                return data;
            }
        },
        change: function () {
            var count = this.total();
            $("#workOrdersSchedulingCount").text(count);
            if (count == 0) {
                $("#zeroWorkOrdersToScheduling").removeClass("displayNone");
                $("#workOrdersSchedulingTable").addClass("displayNone");
                $("#workOrdersSchedulingFooter").addClass("displayNone");
            } else {
                $("#zeroWorkOrdersToScheduling").addClass("displayNone");
                $("#workOrdersSchedulingTable").removeClass("displayNone");
                $("#workOrdersSchedulingFooter").removeClass("displayNone");
                $("#unassignedBackground").removeClass("displayNone");
                $("#unassignedUnderline").removeClass("displayNone");
            }
        }
    });

var technicianDataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: "/sdata/api/dynamic/-/servicesuser?where=Role eq 'Technician'&include=user",
            }
        },
        type: 'sdata',
        schema: { data: "$resources",
            parse: function (data) {
                $.each(data.$resources, function(idx, item) {
                    item['FirstLastName'] = concatFirstLastName(item.User.FirstName, item.User.LastName);
                    item['Id'] = item.User.$key;
                    item['FirstName'] = item.User.FirstName;
                    item['LastName'] = item.User.LastName;
                    //This is the calculated field I cared about

                    item['ServiceDateCalc'] = $.dateUtilities.getUtcDate(item.ServiceDate);      
                    //This one too                          
                    item['ServiceEndDateCalc'] = $.dateUtilities.getUtcDate(item.ServiceEndDate);

                });
                return data;
            }
        }
    });

var schedulingGrid = $("#workOrdersSchedulingTable").kendoGrid({
        dataSource: workOrdersSchedulingDataSource,
        pageable: false,
        sortable: false,
        scrollable: true,
        height: 250,
        dataBound: function () {
            var grid = this;
            $.each(grid.tbody.find('tr'), function () {
                var model = grid.dataItem(this);
                //if Role equals NoRoleAssigned, attach star icon ahead of user name
                if (model.Priority === "Low") {
                    $('[data-uid=' + model.uid + ']' + '>td:first-child').prepend('<span class="staricon">&nbsp;<img src="/Content/images/lowPriority.png" />&nbsp;&nbsp;&nbsp;</span>');
                }
                else if (model.Priority === "Regular") {
                    $('[data-uid=' + model.uid + ']' + '>td:first-child').prepend('<span class="staricon">&nbsp;<img src="/Content/images/regularPriority.png" />&nbsp;&nbsp;&nbsp;</span>');
                }
                else {
                    $('[data-uid=' + model.uid + ']' + '>td:first-child').prepend('<span class="staricon">&nbsp;<img src="/Content/images/criticalPriority.png" />&nbsp;&nbsp;&nbsp;</span>');
                }
            });

            $("table tr").hover(
                function () {
                    $(this).toggleClass("k-state-hover");
                }
            );
        },
        columns: [
            { hidden: true, field: "$key", title: "Key", template: kendo.template($("#tempId").html()) },
            { field: "Priority", title: "Priority", width: "75px"},
            { field: "Customer", title: "Customer", width: "119px", template: "<div style='text-overflow: ellipsis; overflow: hidden; white-space: nowrap;' title='#= Customer.Name #'>#= Customer.Name # </div>"},
            { field: "LocationCity", title: "Location", width: "95px", template: "<div style='text-overflow: ellipsis; overflow: hidden; white-space: nowrap;' title='#= LocationCity #'>#= LocationCity?LocationCity:'N/A' # </div>" },
            { field: "ServiceDate", title: "Start", width: "155px", format: "{0:MM/dd/yyyy hh:mm tt}", template: kendo.template($("#tempStartDate").html()), editor: startDateTimeEditor },
            { field: "ServiceEndDate", title: "End", width: "155px", format: "{0:MM/dd/yyyy hh:mm tt}", template: kendo.template($("#tempEndDate").html()), editor: endDateTimeEditor },
            { field: "AssignedTo", title: "Technician", width: "145px", template: kendo.template($("#tempAssignedTo").html()), editor: assignedToDropDownEditor }
        ], editable: {
            template: null,
            createAt: "bottom"
        }
    });

    function startDateTimeEditor(container, options) {
        $('<input id="serviceDateEditor" data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoDateTimePicker({
                    dataTextField: "ServiceDateCalc",
                    dataValueField: "ServiceDate"
                });
    }
    
    function endDateTimeEditor(container, options) {
        $('<input id="serviceEndDateEditor" data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoDateTimePicker({
                    dataTextField: "ServiceEndDateCalc",
                    dataValueField: "ServiceEndDate"
                });
    }

So, it is working for the first time but after that the format gets messy.

Any suggestions? Thank you.

Guillermo Sanchez
Alexander Valchev
Telerik team
 answered on 08 Jul 2013
1 answer
150 views
Alex
Telerik team
 answered on 08 Jul 2013
7 answers
485 views
On change template in code, the repainting of the grid doesn't seem to expand and produce scrollbars to match the new height of the update grid display.

Here's an example. To reproduce the issue, click on the 'Change Template' button:
http://jsfiddle.net/65kWY/20/

PS. Setting scrollable to true (non-virtual) works just fine.

Vladimir Iliev
Telerik team
 answered on 08 Jul 2013
2 answers
110 views
Hello Community,

First of all I will like to thank Telerik for such a great product, it has been a very good experience developing my first Phonegap in conjunction with Keno UI Mobile, nice work ;)

Secondly, I have found a Bug with the state of buttons, to be more precise the class km-state-active gets stucked when a button is pressed, in navbar or content, so the user once have used a button from that view (back-button, actionsheet navbar button, button within content to open a link... and so on), will always get the button as pressed or with the  class km-state-active attached to it, resulting in a confusing and not so great user experience, and it also makes the App "less native" in a sense.

I have found a temporal solution, and will like to get a confirmation (if possible) from the telerik developing team, after trying to track a bit the matter from kendo.mobile.js, I have found that for some reason some of the new events (comparing events from build 2013.1.319) don't seem to work correctly, I will try to explain myself.

I have used an online javascript beautifier (don't know if links from other sites can be included here) and in line 6725 (this is based in the beautifier I have used, it may differ from your numeration) the function attached to the end it's not even triggering:
end: function (e) {
    t(r, e, !1)
}
What this causes is that the buttons can't listen to the end event and the class km-state-active keeps attached to the element causing this behaviour. 

My solution is to always attach this to the functions which are correctly called by the events, which are press and tap (I've done it in both just in case), which call the functions _activate and _release respectively, code from line 6719-6724 (I insist these are the lines I obtain after uncompressing Javascript with the online tool):
press: function (e) {
    r._activate(e)
},
tap: function (e) {
    r._release(e)
},
So I included at the end of the called functions what the end event was supposed to be doing, resulting in these modified versions, lines 6747-6765:
_activate: function (e) {
     var n = document.activeElement,
         i = n ? n.nodeName : "";
     t(this, e, !0), ("INPUT" == i || "TEXTAREA" == i) && n.blur()
     /*INSERT*/
     ;t(r, e, !1);
     /*INSERT*/
 
 },
 _release: function (t) {
     var n = this;
     t.which > 1 || n.trigger(c, {
         target: e(t.target),
         button: n.element
     }) && t.preventDefault()
     /*INSERT*/
     ;t(r, e, !1);
     /*INSERT*/
 },

After that I minify once more the whole javascript (including the Copyright licence on top once more obviously) and ready to go.

I don't know if this is the best approach but it did the trick for me, and it could also shed some light in tracking down this Bug from the last production version of Kendo UI Mobile (if it stills there of course...).

As I said before, thanks for the great product!
Cho-Lung
Top achievements
Rank 1
 answered on 08 Jul 2013
3 answers
184 views
I'm trying to build a grid that displays a set of users, in this example 5 users, and a pie chart that displays those 5 users' licenses and a block of 5 unused licenses for a total of 10 licenses. This jsbin demonstrates the grid and chart. Click the delete button. Notice the grid removes and row but the chart does not reflect the change.

My question is why doesn't the chartDataSource get refreshed when the gridDataSource's data changes?

I found this post and it does provide a workaround but I don't see why the chartDataSource function doesn't get called when model.get('gridDataSource') is used inside of it and clearly the gridDataSource changes.

Here is a jsbin that demonstrates the workaround.

Thanks,
Jon
Alexander Valchev
Telerik team
 answered on 08 Jul 2013
4 answers
382 views
Hi, I'm new to KendoUI, something i not understand is what is the different between

var slider = $('#slider').kendoSlider().data('kendoSlider');

and 

var slider = $('#slider').kendoSlider();

?

what is the .data() method for?

thanks.
CH
Top achievements
Rank 1
 answered on 08 Jul 2013
17 answers
693 views
I'm wanting to changed the default behavior of when you hit enter and it double space to be single spacing when you hit Shift + Enter, but I cannot find out where Shift + Enter is being performed in the source. Also under JavaScript Dependencies there is no list of the required JavaScript files for the editor. Thanks
Alex Gyoshev
Telerik team
 answered on 08 Jul 2013
0 answers
123 views
<label>IP Setting
    <input id="ip1" type="number" value="192" min="1" max="999"/>
    <input id="ip2" type="number" value="168" min="1" max="999"/>
    <input id="ip3" type="number" value="0" min="1" max="999"/>
    <input id="ip4" type="number" value="0" min="1" max="999"/>
</label>
the code is used for set IP address,  when touch any one of  these input forms ,the focus can only be set on the first one ,
 then the ipad virtual keyboard show up ,  how to adjust this to set focus on the touch one ?
ai
Top achievements
Rank 1
 asked on 08 Jul 2013
12 answers
500 views
I have a template like this:
<script type= "text/x-kendo-template" id="favoritesTemplate">
	# for (var i = 0; i < data.length; i++) { #
		<li>
            <a onClick=showSwimmer('${data[i].SwimmerID}')>${data[i].Firstname + ' ' + data[i].Lastname}</a>
            <a data-role="detailbutton" data-icon="refresh"></a>
        </li>
	# } #
</script>

It seems the widget in the template (in this case a detailbutton) is not really interpreted - and it never shows up in the final markup.

Is there any way to achieve this?

Thanks.
Brandon Peterson
Top achievements
Rank 2
 answered on 05 Jul 2013
0 answers
39 views
Hi,
I created a new mvc 4 web application project. I then compiled and ran the project.
Then I went to the logon page and clicked on the username textbox. All is well.
I then stopped the project, went to the telerik menu and chose convert to kendo.
I then ran the project again and went to the login page and clicked on the username textbox.
This time:
Unhandled exception at line 1234, column 5 in  /Scripts/jquery.validate.js0x800a138f
Microsoft JScript runtime error:
Unable to get value of the property 'call': object is null or undefined


Very easy to reproduce, very hard to understand what's going on.
Please help ... Ed
Randy Hompesch
Top achievements
Rank 1
 asked on 05 Jul 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
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
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?