Telerik Forums
Kendo UI for jQuery Forum
1 answer
110 views

This is regarding an issue that we are facing with combo box column sorting , if we bind a string fields as “DatavalueField “ and do sorting on Combo box column Kendo grid binding is braking. But this works if we bind numeric field with DatavalueField and it sorts with this field. But in our case we need to sort by the field bound to DataTextField (which is in the UI). Please suggest possible solution or work around to address this issue.

Looking forward to hear from you soon - thanks in advance.

Georgi Krustev
Telerik team
 answered on 11 Aug 2016
1 answer
266 views

This is regarding an issue that we are facing with combo box column sorting , if we bind a string fields as “DatavalueField “ and do sorting on Combo box column Kendo grid binding is braking. But this works if we bind numeric field with DatavalueField and it sorts with this field. But in our case we need to sort by the field bound to DataTextField (which is in the UI). Please suggest possible solution or work around to address this issue.

Looking forward to hear from you soon - thanks in advance.

Georgi Krustev
Telerik team
 answered on 11 Aug 2016
1 answer
8.2K+ views
I want to be able to dynamically set the column headers. The title attribute of the columns is not sufficient, see below:
 columns: [
            { field: "CustomerNumber", title: "Customer Number", attributes: { style: "white-space: nowrap" } },
            { field: "CustomerName", title: "Customer", attributes: { style: "white-space: nowrap" } },
            { field: "InvitationEmail", title: "Email", template: "<a href=\"mailto:#=InvitationEmail#\">#=InvitationEmail#</a>", attributes: { style: "white-space: nowrap" }},
        ]

How do I set the title dynamically? These values typically come from the resource file.
Vladimir Iliev
Telerik team
 answered on 11 Aug 2016
4 answers
914 views
Hello,

I've tried

.
.
.
            schema: {
                type: "json",
                model: {
                    id: "id",
                    fields: {
                        c_pmchart: {type: "string", validation: { required: true }},
                        defi: { type: "string", validation: { required: false }, defaultValue: function () {return 'test value';} },
.
.
.

to set a field's defaultValue via an anonymous function but it di not work. Any ideas how to set deafultValues by a function  ?

TIA
Nikolay Rusev
Telerik team
 answered on 11 Aug 2016
3 answers
105 views

I am using an Event Template that does not have the end datetime visible to the end user. The actual end datetime is calculated based on other dropdown selections made which give a duration for the task that is then added to the start datetime.

The event creation works fine but initially the event block only occupies the default slot for the view (e.g. 30mins for the day, week views). If I change the view (advance a day say) and then return back the block now correctly occupies the time slots associated with its start/end datetimes.

How can I get the scheduler to redraw the block when created?

Vladimir Iliev
Telerik team
 answered on 11 Aug 2016
4 answers
265 views
I saw on this thread the solution to the grouping problem when using row template by using jQuery $.proxy

Now i have my grid with MVVM binding. Is it possible to use $.proxy in data-row-template?

Here's a simplified fiddle of my code: http://jsfiddle.net/MhWVn/2/


Vladimir Iliev
Telerik team
 answered on 11 Aug 2016
1 answer
138 views

when the scheduler is in "mobile" mode, e.g. the view selector goes from buttons to a single dropdown, whenever you click the dropdown, it calls my navigate and paramterMap function and calls the read api. Then when i select the new view it calls again. All calls have the correct date ranges.

how do i get stop the first call from occurring? e.g. it is making 2 calls every time. The second call is the correct call. The first call is essentially re-calling the initialization script or pulling in the same data it already has loaded.

 

code snippet

 

            $("#scheduler").kendoScheduler({
                toolbar: ["pdf"],
                pdf: {
                    fileName: "My_School_Year_Calendar.pdf",
                    proxyURL: "//demos.telerik.com/kendo-ui/service/export"
                },
                startTime: today,
                date: today,
                timezone: "",
                allDayEventTemplate: adTemplate,
                eventTemplate: eTemplate,
                views: [
                    { type: "agenda", selected: true },
                    "day",
                    "week",
                    "month"
                ],
                editable: false,
                dataBound: scheduler_dataBound,
                dataSource: {
                    transport: {
                        read: {
                            url: "@Url.Action("Calendar", "Homeroom")",
                            dataType: "json",
                            contentType: "application/json; charset=utf-8",
                            type: "POST"
                        },
                        parameterMap: function (options, operation) {

                            if (operation === "read") {
                                var scheduler = $("#scheduler").data("kendoScheduler");

                                var result = {
                                    start: scheduler.view().startDate().toMsyString(),
                                    end: scheduler.view().endDate().toMsyString()
                                };
                                return kendo.stringify(result);
                            }
                            return kendo.stringify(options);
                        }
                    },
                    serverFiltering: true,
                    schema: {
                        model: {
                            id: "taskID",
                            fields: {
                                classId: { from: "ClassId", type: "number" },
                                taskID: { from: "TaskID", type: "number" },
                                title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                                start: { type: "date", from: "Start" },
                                end: { type: "date", from: "End" },
                                ownerId: { from: "StudentId", defaultValue: 1 },
                                isAllDay: { type: "boolean", from: "IsAllDay" }
                            }
                        }
                    }
                },
                filter: {
                    logic: "or",
                    filters: [
                        { field: "ownerId", operator: "eq", value: 513 },
                        { field: "ownerId", operator: "eq", value: 531 }
                    ]
                },
                resources: [
                    {
                        field: "ownerId",
                        title: "Student",
                        dataSource: [
                            @Html.Raw(@Model.Sources.StudentResourceJs)
                        ]
                    }
                ],
                change: function (e) {
                    var start = e.start;
                    var end = e.end;

                    console.log(kendo.format("Selection between {0:g} and {1:g}", start, end));
                },
                navigate: function (e) {
                    console.log("navigate", e.date);
                }
            });

Robert
Top achievements
Rank 1
 answered on 10 Aug 2016
2 answers
565 views
What is the best way to call my short_text() function so that I have a new shortMessage field in my datasource schema? I want to pass the Message field to the function and create a new field called shortMessage and have this used in the template.  Is this even possible at all?

    <div data-role="view" data-title="Control Panel - Mobile" id="listmessages" data-init="listMessagesInit">
        <h2>Customer Messages</h2>
        <p><?php echo $unread_messages . ' - unread messages'; ?></p>
        <ul id="message_list"></ul>
    </div>
     
    <script id="message_list_template" type="text/x-kendo-template"><a href=""><div style="float:left; width:150px; height: 50px" class="isnew_#= isnew #">#= customer_name #<br />#= created #</div><div style="height: 50px"id="message_#= id #" class="isnew_#= isnew #">#= message #</div></a></script>
 
<script>
 
     function listMessagesInit(){
          
         function short_text(id, message){
          if (message.length > 100){
           var shortText = jQuery.trim(message).substring(0, 100).split(" ").slice(0, -1).join(" ") + "...";
          } else {
           var shortText = message;
          }
           
          $(id).text(shortText);
      }
 
          var dataSource = new kendo.data.DataSource({
            
            transport: {
                read: "/messages/data",
                dataType: "json",
                update: {
                    url:  function() {
                        var url = "/messages/markasread/" + id + "/" + read;
                        return url;
                    },
                    type: "POST",
                    dataType: "json"
                },             
 
                destroy: {
                    url:  function() {
                        //where id is a global variable
                        var delurl = "/messages/delete/" + id;
                        return delurl;
                    },                     
                    type: "DELETE",
                    dataType: "json"
                }
                         
            },               
            schema: {
              model: {
                  id: "id",
                  fields: {
                      created: { type: "string" },
                      message: { type: "string" }, 
              //shortMessage: - how to call the short_text() function here?  Is it possible??
                      customer_name: { type: "string" },   
                      customer_telephone: { type: "string" },
                      ip: { type: "string" },
                      created: { type: "string" }, 
                      email: { type: "string" },
                      isnew: { type: "string" }
                     }
                 }
             }      
           });
 
          $("#message_list").kendoMobileListView({
              dataSource: dataSource,
              //pullToRefresh: true,
              //appendOnRefresh: true,
              style: "inset",
              click: function(e) {
                var id = e.dataItem.id;
                var selected = dataSource.get(id);
                window.kendoMobileApplication.navigate("/messages/view/" + id);
              },         
              template: $("#message_list_template").text()
          });
           
     }
    </script>
     
    <style>
    #listmessages div.isnew_1 {font-weight:bold}
    #listmessages div.isnew_0 {font-weight:normal}
     
   </style>    
Brittany
Top achievements
Rank 1
 answered on 10 Aug 2016
2 answers
583 views

I'm having an issue with the enabled binding of a button. It's bound to function on a view model (kendo.observable) that returns a Boolean value based on the values of properties on the same view model. The binding runs once, when bound, but never again after the properties of the view model have changed. Is there any way that I can get this binding to 'refresh' on property change? Code below:

var viewModel = kendo.observable({
    userName: null,
    password: null,
    isEnabled: function () {
        var self = this;
 
        return self.userName != undefined && self.password != undefined;
    }
});

And the HTML:

<button class="k-button k-primary" data-bind="click: onClicked, enabled: isEnabled">Click</button>

 

 

 

Heath
Top achievements
Rank 1
 answered on 10 Aug 2016
1 answer
178 views

I'm attempting to connect an OData datasource from Datadirect's on-premise MS SQL connector to KendoUI instances.  I can successfully get a response, but the format of the response seems to be throwing errors for Javascript/Kendo UI. "Uncaught SyntaxError: Unexpected token : " with reference to the URL for the JSON response from Datadirect's connector.

 

I suspect I need to configure the schema for the datasource to parse beyond the "d" : , but have been unsuccessful so far.  There are 2 records in the JSON response below that I am trying to populate to a Kendo UI grid.

{
"d" : {
"results" : [
{
"__metadata" : {
"uri" : "https://place.ontheinternet.com/api/odata/data/table", "type" : "mspsql3.Users"
}, "UserID" : 1, "Username" : "host", "FirstName" : "SuperUser", "LastName" : "Account", "IsSuperUser" : true, "AffiliateId" : null, "Email" : "hjghjg@gvghtrdt.com", "DisplayName" : "SuperUser Account", "UpdatePassword" : false, "LastIPAddress" : null, "IsDeleted" : false, "CreatedByUserID" : -1, "CreatedOnDate" : "\/Date(1365162224930)\/", "LastModifiedByUserID" : 245, "LastModifiedOnDate" : "\/Date(1440941627913)\/", "PasswordResetToken" : "00000000-0000-0000-0000-000000000000", "PasswordResetExpiration" : null
}, {
"__metadata" : {
"uri" : "https://place.ontheinternet.com/api/odata/data/table", "type" : "mspsql3.Users"
}, "UserID" : 2, "Username" : "drew", "FirstName" : "Drew", "LastName" : "SK", "IsSuperUser" : true, "AffiliateId" : null, "Email" : "fdjk@fjkndnj.com", "DisplayName" : "DrewSK", "UpdatePassword" : false, "LastIPAddress" : "127.0.0.1", "IsDeleted" : false, "CreatedByUserID" : 1, "CreatedOnDate" : "\/Date(1365176462207)\/", "LastModifiedByUserID" : -1, "LastModifiedOnDate" : "\/Date(1366149209000)\/", "PasswordResetToken" : null, "PasswordResetExpiration" : null
}
], "__count" : "495"
}
}

Drew
Top achievements
Rank 1
 answered on 10 Aug 2016
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
SmartPasteButton
PromptBox
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?