Telerik Forums
Kendo UI for jQuery Forum
4 answers
1.7K+ views

Hello,

I have implemented the kendo UI drop down list in jQuery making use of the no data template too add a new item when the search returns no results.  My no data template is defined as follows:

 

    <script id="noDataTemplate" type="text/x-kendo-tmpl">
        <div>
            <button class="k-button" onclick="addNew('#: instance.filterInput.val() #')">Add</button>
        </div>
    </script>

and the JS function it calls:

 

 function addNew(newItemName) {
           alert(newItemName);

       //logic will go here to add the new item to the drop down list

        }

 

This works perfectly, however if the text typed into the search bar contains an apostrophe the button becomes unresponsive. Is there any way to escape the apostrophe so that the function is still called successfully, and the paramter 'newItemName' will still contain the apostrophe, as the name for the new item can validly contain one.

Many thanks

newKendoUser
Top achievements
Rank 1
 answered on 23 May 2018
1 answer
345 views

We have a customer that has several sizing requests in regards to having the scheduler in month view automatically resize to show all data (show everything regardless of size). The default static positioning/height/width using tables will not work for them.

For events, if their name wraps 2,3,4,... lines, they want the event box to auto-grow its height to show all text. The static EventHeight setting will not do.

The days that show/hold the events, needs to auto grow their height as well to fit in all events, even if there are 10 events for 1 day. They don't want the "..." to switch over to the day view from the month view to see all. So likely the row for that week would auto-grow to be able to hold the 1 day with 10 events.

Any resources/thoughts on how we may approach this?

Ivan Danchev
Telerik team
 answered on 23 May 2018
3 answers
370 views

    Hello Telerik Team,

I have signed up for a Trial of Kendo UI JS to check out whether your product will solve a business case we are trying to build with a web application.

I have an issue with filtering on the values of the graphs. 

Please have a look at the following screenshot:

chart before filtering

Here, you can see an unfiltered view of an example chart. 

This chart's data comes from a web interface, and for this particular example it is:

[{"Date":"2018-01-02","Name":"Karol","Points":"2","CalculatedValue":"2","CreatedAt":"05/20/2018"},
{"Date":"2018-01-02","Name":"Karol","Points":"6","CalculatedValue":"6","CreatedAt":"05/20/2018"},
{"Date":"2018-01-02","Name":"Peter","Points":"4","CalculatedValue":"4","CreatedAt":"05/20/2018"},
{"Date":"2018-01-06","Name":"Matthew","Points":"8","CalculatedValue":"8","CreatedAt":"05/20/2018"}]


My aggregate is "sum", so for example on 2018-01-02 for "Karol" the sum is 8.

Whenever I want to filter on values greater than 6 on the WHOLE chart suddenly the values of "Karol" are no longer visible. This _makes_ sense becuase there is no single point of data that is greater than 6 for Karol, but since my aggregate is sum, I would have expected for Kendo UI to filter aggregates, and therefore still show me the values for Karol.

chart after filtering

Please look at my setup for the DS and the Chart. Could you please tell me how should I set up the filtering in order to filter on actual aggregate values, instead of their base fractions?


var ds = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "/xx/xxxxx",
                        data: {
                            id: xxx
                        },
                        dataType: "json",
                        type: "post"
                    }
                },
                group: {
                    field: "Name",
                    aggregates: [
                        { field: "CalculatedValue", aggregate: "sum" }
                    ]
                },
                sort: {
                    field: "Date",
                    dir: "asc"
                },
                schema: {
                    model: {
                        fields: {
                            CalculatedValue: {
                                type: "number"
                            },
                            CreatedAt: {
                                type: "date",
                                format: "{0:dd/MM/yyyy}"
                            },
                            "Date": {
                                    
                                type: "date",
                                format: "{0:yyyy-MM-dd}"

                                    
                            }
                        }
                    }
                }
                    ,
                filter: [
                ]
            });


            $("#chart-div-calc-148-_25392").kendoChart({
                theme: "moonlight",
                dataSource: ds,
                seriesColors: [
                    "#0C6BC1", "#06CAEA", "#F7A9F7", "#A00B00", "#FF9900", "#EDED11", "#00E000", "#00722E", "#CF00E9",
                    "#7427D8", "#072DE8", "#FFFFFF", "#878787", "#F43F00"
                ],
                title: {
                    text: "Filter",
                    align: "left"
                },
                legend: {
                    position: "right",
                    cursor: "pointer",
                    orientation: "vertical"
                },
                series: [
                    {
                        type: "line",
                        field: "CalculatedValue",
                        style: "smooth",
                        name: "#= group.value #",
                        categoryField: "Date",
                        aggregate: "sum",
                        labels: {
                            visible: false,
                            format: "{0:N2}"
                        }
                    }
                ],
                tooltip: {
                    visible: true,
                    shared: false,
                    format: "{0:N2}",
                    template: '${series.name}: <b style="font-size: 1.1em"> ${value}</b>'
                    //template: '#= kendo.format("{0:d-MMM-yyyy}", category)#',
                    //template: "${series}: ${value}"
                },

                valueAxis: {
                    labels: {
                        format: "{0:N0}"
                    },
                    title: {
                        text: ""
                    }
                },
                pannable: {
                    lock: "y"
                },
                zoomable: {
                },

                render: function(e) {
                    var loading = $('#chart-loading-148-_25392', e.sender.element.parent());
                    console.dir(this);
                    var totalmax = -6666 + (this._model._plotArea.valueAxis.totalMax * 0.01);


                    if ($(this).data('putPlots') == null) {

                        var axisNames = ["valueAxis"];
                        var options = {};

                        for (var i = 0; i < axisNames.length; i++) {
                            options[axisNames[i]] = { plotBands: [{
                                from: -6666,
                                to: totalmax,
                                color: '#00FF00',
                                opacity: 1
                            }] };
                        }

                        console.dir(options);
                        $(this).data('putPlots', true);
                        this.setOptions(options);


                }
                    kendo.ui.progress(loading, false);
                },
                categoryAxis: {
                    majorGridLines: {
                        visible: false
                    },
                    categoryField: "Date"
                        
                        ,type: "date",
                        baseUnit: "days",
                        //baseUnitStep: "auto",
                        baseUnit: "days"
                        
,
                    labels: {
                            
                            format: "dd-MMM-yyyy",
                            weekStartDay: 1,
                            
                        rotation: "auto"
                    }

                }
            });
        }

 

 

 

 

Thank you in advance for looking into it

Stefan
Telerik team
 answered on 23 May 2018
3 answers
2.7K+ views
Hi Team,

I am using kendo css version : Kendo UI v2014.2.716

But in this the vertical scroll for the grid id not getting affected, it always grows according to data.
Is there any possibility to fix without changing the version?


Thanks
Arathi
Stefan
Telerik team
 answered on 23 May 2018
2 answers
3.3K+ views

Even though many similar topics can be found on the internet, I wasn't able to bind my dropdownlist value within a scheduler template:

 

this is my code within the template:

 

<div class="k-edit-label"><label for="trainerId">Trainer</label></div>

<div data-container-for="trainerId" class="k-edit-field">
    <input id="trainerId" name="trainerId"
           data-bind="value:trainerId"
           data-role="dropdownlist" />
</div>

 

the dropdownlist is beeing created by edit event of scheduler:

 

  // Creating dynamic dropdown
            e.container.find("#trainerId").kendoDropDownList({
                dataTextField: "Text",
                dataValueField: "Value",
                change: function(e) {
                   
                },
                dataSource: {
                    transport: {
                        read: {
                            type: 'post',
                            dataType: "json",
                            url: '@Url.Action("Trainers_List","Trainer")',
                        }
                    }
                }
            });

 

Fiddler shows :

'TrainerId' is listed in the body but has no value.

Instead there are other fields like:

trainer.Disabled,

trainerId.Sorting,

trainerId.Value which actually holds the correct value.

 

What am I doing wrong here?

Dimitar
Telerik team
 answered on 22 May 2018
1 answer
137 views

Hi,

I'm using a custom popup edit template for my grid where I'm using a datetimepicker with data attributes.

I would like to use disableDates function to allow only a range between [PlannedFromTemp, PlannedToTemp], but until now I was not able to pass the "date" argument in the function as in the documentation here.

 

How can I pass the "date" in my test function as in the documentation, but in my concrete custom template?

 <input id="Timefrom" name="Timefrom"
               data-type="date"
               data-role="datetimepicker"
               data-bind="value: Timefrom"
               data-format="dd.MM.yyyy HH:mm"
               data-time-format="HH:mm"
               data-disable-dates="#= test(date, PlannedFromTemp, PlannedToTemp) # " 
             
              />

 

Thank you in advance,

 

 

Alex Hajigeorgieva
Telerik team
 answered on 22 May 2018
8 answers
4.9K+ views

Hello

Based on API documentation there is no method/option to enable/disable action buttons defined in a dialog. 

Is there a way to enable/disable action buttons in a dialog?

Regards

 

Tayger
Top achievements
Rank 1
Iron
Iron
 answered on 22 May 2018
2 answers
4.0K+ views

Hello

I'm using a dialog widget. By default the dialog closes on clicking on any defined action buttons. I would like to prevent that and close the dialog programmatically. How can I set the defined action buttons to not close after clicking on them?

Regards

Tayger
Top achievements
Rank 1
Iron
Iron
 answered on 22 May 2018
2 answers
149 views

Is the custom download builder still being updated for the R2 2018 update? I'd like to add DropDownTree to my custom bundle but the list of components is empty for 2018.2.516.  CDN seems to be updated as I can navigate manually to kendo.dropdowntree.min.js

Preslav
Telerik team
 answered on 22 May 2018
1 answer
887 views
For the life of me, I cannot find out how to update a row's group when I'm using drag and drop to drop a row from one group to another.
Here is my grid's schema:
//Defines grid of main Kendo grid for Questions
   $scope.questionsDataSource = new kendo.data.DataSource({
       autoSync: true,
       schema: {
           model: {
               fields: {
                   GroupId: { type: "int", editable: false },
                   GroupName: { type: "string", editable: false, title: "Group" },
                   GroupSortOrder: { type: "int", editable: false },
                   Id: { type: "int", editable: false },
                   Text: { type: "string", editable: true },
                   AnswerTypeLU: { type: "int", editable: false },
                   RowNumber: { type: "int", editable: false },
                   IsRequired: { type: "bool", editable: false },
                   IsHidden: { type: "bool", editable: false },
                   AllowNotes: { type: "bool", editable: false },
                   AllowAttachFiles: { type: "bool", editable: false },
                   Special: { type: "string", editable: false },
                   Response: { type: "string", editable: false },
                   AnswerId: { type: "int", editable: false },
                   AnswerValue: { type: "string", editable: false },
                   CorrectAnswer: { type: "bool", editable: false },
                   AnswerBitValue: { type: "int", editable: false },
                   AnswerArray: { type: "string", editable: false },
               }
           }
       },
       //This allows the Kendo grid to group questions based on the group they are in
       group: {
           field: "GroupName"
       },
       //Sets default sort order for table. Current settings sorts by row and number
       sort: [ { field: "RowNumber", dir: "asc" }]
   });




Here is my grid:
$scope.questionsGrid = {
        dataSource: $scope.questionsDataSource,
        scrollable: false,
        sortable: true,
        selectable: 'multiple',
        resizable: true,
        persistSelection: true,
        filterable: true,
        reorderable: true,
        editable: false,
        columnMenu: true,
        excel: {
            fileName: "questionnaire.xlsx",
            allPages: true,
            proxyURL: "/Common/FileHandlers/KendoSaveFile.aspx"
        },
        toolbar: kendo.template('<div class="toolbar">' +
            '<a type="button" id="questionsGridExport" class="btn btn-default k-button-icontext k-grid-Export pull-right"><span class="k-icon k-i-excel"></span>Export to Excel</a>' +
        '</div>'),
        dataBound: function (e) {
            $scope.dataBound(e);
        },
        columns: [ //Add, remove, or customize kendo columns here
            ////{ field: "GroupName", template: "#=GroupName#", groupHeaderTemplate: "Group: #=value#" },
            //{ title: '<input onclick=\'selectAll(this)\' type=\'checkbox\' />', template: "<input class='checkbox' type='checkbox' />", width: "30px" },
            { field: "RowNumber", title: "#", width: "10px" },
            {
                field: "Text", title: "Question",
                groupHeaderTemplate: "Name: #:count#",
                template:
                    //Quick Kendo Tip: 'dataItem' is key for plugging in data
                    //These 3 rows add icons for if the question is required, notes are allowed, and if attach files are allowed
                    "<i ng-show='questionAddon(dataItem.IsRequired)' style='color:red; float:right;' class='fa fa-asterisk addon pull-right;'></i>" +
                    "<i ng-show='questionAddon(dataItem.AllowNotes)' style='color:orange; float:right;' class='icon icon-note addon'></i>" +
                    "<i ng-show='questionAddon(dataItem.AllowAttachFiles)' style='color:dodgerblue; float:right;' class='icon  icon-cloud-upload addon'></i>" +
                    "<i ng-show='questionAddon(dataItem.MultiFileUpload)' style='color:purple; float:right;' class='fa fa-copy addon'></i>" +
                    "#: Text #" //Kendo template function overides anything that would normally show in the 'field'. So you need to have '#: fieldName #' included in the template to show the field data
            },
            { field: "IsRequired", title: "Required", template: "{{Is_Required[dataItem.IsRequired]}}" },
            { field: "AnswerValue", title: "Answer" },
            { field: "AnswerTypeLU", title: "Type", template: "{{AnswerTypeLUCodes[dataItem.AnswerTypeLU]}}" },
            {
                title: "Edit",
                template: "<button class='btn btn-default' data-target='.edit-question-modal' ng-click='editQuestion(dataItem)' data-toggle='modal' style='margin:0px; padding:2px 5px 2px 5px;'><i class='fa fa-pencil' title='Edit' style='margin-right:5px;'></i>Edit</button>",
                width: "30px",
            },
            { field: "questionId", hidden: true, title: "Id", template: "{{dataItem.Id}}" },
        ]
    }


And this is the "change" event function. I would have thought there would be something in the "e" (event parameter) of the change event that tells me the new group I'm dropping this row into. That's all I need to know and I can do the rest:

$scope.sortableOptions = { //This needs it's own Kendo sortable wrapper to make the table sortable in the HTML doc
        filter: ".k-grid tr[data-uid]",
        //cursor: "move",
        placeholder: function (element) {
            return element
            .clone()
            .removeAttr("uid")
            .addClass("k-state-hover")
            .css("opacity", 0.65);
        },
        container: ".k-grid tbody",
        change: function (e) {
            var grid = $scope.questionsGrid;
            var oldIndex = e.oldIndex;
            var newIndex = e.newIndex;
            var dataItem = grid.dataSource.getByUid(e.item.data("uid"));
 
            // reorder the datasource
            if (newIndex != oldIndex) {
                grid.dataSource.remove(dataItem);
                grid.dataSource.insert(newIndex, dataItem);
            }
 
            var droppedQuestions = $.grep($scope.questionnaire.FlatQuestions, function (data, index) {
                return dataItem.Id === data.Id;
            });
            var questiontoUpdate = droppedQuestions[0];
            questiontoUpdate.SortOrder = newIndex;
            questiontoUpdate.RowNumber = newIndex + 1;
 
            var questionsGrid = $("#questionsGrid").data("kendoGrid");
            var data = questionsGrid.dataSource.data();
            var totalNumber = data.length;
            var csv_sorted_questioIds = "";
 
            var currentGroupId = null;
            var currentGroupName = "";
            var currentGroupSortOrder = 0;
            var needToSaveQuestion = false;
 
            // get the list of questionIds in the order we want
            for (var i = 0; i < totalNumber; i++) {
                var currentDataItem = data[i];
                // get the group info of the current data item
                currentGroupId = currentDataItem.GroupId;
                currentGroupName = currentDataItem.GroupName;
                currentGroupSortOrder = currentDataItem.GroupSortOrder;
 
 
                if (csv_sorted_questioIds === "") {
                    csv_sorted_questioIds = currentDataItem.Id.toString();
                }
                else {
                    csv_sorted_questioIds += "," + currentDataItem.Id.toString();
                }
 
                if (newIndex === i && questiontoUpdate.GroupId !== currentGroupId) {
                    // update the row with the new group info
                    questiontoUpdate.GroupId = currentGroupId;
                    questiontoUpdate.GroupName = currentGroupName;
                    questiontoUpdate.GroupSortOrder = currentGroupSortOrder;
                    needToSaveQuestion = true;
                }
            }
 
            $scope.saveQuestionSortOrder($scope.clientData.EventId, $scope.clientData.QuestionnaireId, $scope.questionnaire.HostCompanyId, $scope.questionnaire.Name, $scope.questionnaire.Label, csv_sorted_questioIds);
        }
    };

Stefan
Telerik team
 answered on 22 May 2018
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?