Telerik Forums
Kendo UI for jQuery Forum
2 answers
988 views

Hello everyone,

right now the Angular2 AutoComplete compontent only supports string values, which is not sufficent in a scenario, where you want to find for example a customer based on his name. There could be multiple entities with the same name, but I also do not want to display the database id to the user. So what to do?

I hope, that this will get implemented in the AutoComplete Component soon, but for now this is my workaround I would like to share:

1. You have to modify the autocomplete.component.js so it will accept complex objects without throwing an exception. 
Remove the if statement from lines 315-317: 

if (util_1.isPresent(newValue) && typeof newValue !== "string") {
            throw new Error("Expected value of type string. See http://www.telerik.com/kendo-angular- ;           ui/components/dropdowns/autocomplete/#toc-value");
}

 

Remove the first "toLowerCase()" call from line 426, so it should look like this:

else if (text && text === this.searchbar.value.toLowerCase()) {

 

And that is it. You can now pass an Array of customers to as [data]

<kendo-autocomplete #customersAutocomplete
                    [data]="customers"
                    [(ngModel)]="selectedCustomer"
                    [suggest]="false"
                    [filterable]="true"
                    (filterChange)="customerTextChange($event)">
    <template kendoAutoCompleteItemTemplate let-dataItem>        
            <span>{{dataItem.firstName}} {{ dataItem.lastName}}</span><br />
            <span>{{dataItem.birthDateLocal}}</span><br />
            <span>{{dataItem.customerNumber}}</span><br />
        </div>
    </template>
</kendo-autocomplete>
<button *ngIf="customersAutocomplete.value"
        (click)="selectedCustomer=null; customersAutocomplete.value=null;">x
</button>

 

However there are some things you have to be aware of:

When you select a value from the AutoComplete there will be two consecutive value changes. First will be your complex object, the second will be the string representation (customer.toString()). So I recommend, that you use a setter on your ngModel:

public set selectedCustomer(value: Customer) {
        if (!value || value instanceof Customer) {
            this._selectedCustomer= value;
        }
    }

 

You also should write a toString() on your model, that you can display to the user.

I hope this helps some people and maybe serves as a suggestion for the Telerik guys.

 

Niels
Top achievements
Rank 1
 answered on 01 Feb 2017
1 answer
887 views

Hi, 

I've created an inline grid to perform CRUD operations, but am having a slight problem with validation. The standard inline grid validates its fields based on the attributes of the schema and the column (I think). My grid has custom editors for each value displayed, I assume this is why the 'validation' details of each schema attribute are ignored. Please correct me if Im wrong.

How can I trigger the Inline Grid validation for my custom fields so any resulting error messages are displayed as Tooltips (eg; http://demos.telerik.com/kendo-ui/grid/editing-inline) instead of additional elements like the standard validator?

Thanks In Advance,
Grant

Dimiter Topalov
Telerik team
 answered on 01 Feb 2017
12 answers
373 views

Hi

I am using multiple tree lists in my project so have it set up using a directive. I am getting some serious memory leaks that is rendering the app and browser unusable and I have narrowed it down to one area. I have managed to recreate this in a dojo as well and you can test the memory leak by changing the template variable and then keep expanding columns.

in the setupTree() in the directive I have a column with checkboxes that uses angular. Using the normal template and expanding the rows in the tree chromes memory starts climbing and goes up over 1gb of usage and over time will keep climbing, sometimes going over 2gb. I found that by taking everything out except for an ng-disabled the memory usage goes up slower but it still keeps climbing and never comes down. If I take out all of the angular the memory climbs a bit but then gets garbage collected and stays low.

I would like to add that the data used for this tree is relatively small compared to some of the real data that will be used.

Thanks and regards,

Simon

dojo.telerik.com/@Simon245/ewawi

Stefan
Telerik team
 answered on 01 Feb 2017
1 answer
461 views

Hi,

First:

I have charts on a dashboard where data is 10,000 or more rows per chart and from different tables.  This is causing me a very slow and hang kind of situation. Many time browser ask me to kill the long running java scripts.

Is there any way where I can manage data loading on panning and zooming of the charts? For example, I will bring all the data from data tables and will keep on browser in JSON format somewhere in "data dash" attribute. I will load first 10 or 15 records only which will show 10 or 15 bars on a chart. After that as soon as I will start panning, records will keep adding into charts and more bars will be displayed.

It will help us to load dashboard quickly.

Second:

Is there any way to communicate to user that this chart is panning enabled or zoom-able. For example scroll bar or arrow etc.

 

Daniel
Telerik team
 answered on 01 Feb 2017
1 answer
368 views

I've been working with adding some custom binders, via typescript, to our project. All of the examples show that overriding the 'init' function is how I am supposed to parse attributes from the elements into (e.g.) custom properties. The issue I'm having is that the overridden 'init' function *never* seems to be called. If I switch to overriding the constructor, instead of init, this works as expected.

My question is - am I doing this incorrectly, is there anything inherently wrong with overriding the constructor itself, and *why* doesn't the override on init actually fire? I've tried this several ways, at this point I'm exactly duplicating the structure from kendo.d.ts, going with the assumption that the override might not fire if typescript doesn't see an exact match.

Again, note that the below extension is working - BUT if I were to remove the constructor override, the init override would never be called (confirmed via multiple debugging attempts).

module kendo.data.binders {
    export class date extends kendo.data.Binder {
        dateformat: string = "d";
 
        constructor(element: any, bindings: Bindings, options?: BinderOptions) {
            //call the base constructor
            super(element, bindings, options);
 
            this.dateformat = $(element).data("dateformat");
        }
 
        //Note: this NEVER seems to be called
        init(element: any, bindings: Bindings, options?: BinderOptions): void {
            //call the base constructor
            kendo.data.Binder.fn.init.call(this, element, bindings, options);
 
            this.dateformat = $(element).data("dateformat");
        }
 
        refresh() {
            var data = this.bindings["date"].get();
            if (data) {
                var dateObj = new Date(data);
                $(this.element).text(kendo.toString(dateObj, this.dateformat));
            }
        }
    }
}
Dimiter Topalov
Telerik team
 answered on 01 Feb 2017
1 answer
229 views

Hi everybody,

I'm using a kendo dropdown list as a custom editor in grid. I wonder, is there an easy way to make the width of dropdownlist bigger then the size of the cell? I display short codes in a grid, but I have to display long names in edit mode in dropdown list. I thought about something like openning  it in front of the grid, covering the whole grid not only the container cell. But I was unable to find an example.

 

Dimo
Telerik team
 answered on 01 Feb 2017
1 answer
607 views

I have a custom event editor template for a scheduler. I have certain components in my template I want hidden until the user selects a certain recurrence value from the dropdown. If they select daily, weekly, monthly, or yearly, different input values should become visible to them under the recurrence selector (using kendo's recurrenceeditor component).

 

I am wondering where I get the recurrence html object, in the script activating the scheduler (main script) or the script that holds the template for the editor? Then how do I set an event to catch when the value of the recurrenceeditor changes to hide/reveal the components I want?

 

Thank you for any help!

Peter Milchev
Telerik team
 answered on 31 Jan 2017
1 answer
227 views

accoring to the documentation the grid has a group event, but no unGroup event.

How can I detect if a grid is in a grouped state?

Tsvetina
Telerik team
 answered on 31 Jan 2017
3 answers
366 views

I'm using a grid's edit event to modify the title of the popup kendo ui window.

This code worked fine in 2016.1.226, but now in 2017.1.118 it does not.  After upgrading, the title now looks disabled and the window acts as if it doesn't have a title bar at all (cannot be dragged, cannot be closed by the X, etc).

function gridEdit(e) {
    if (e.model.isNew()) {
        e.container.kendoWindow("title", "Add New User");
    }
    else {
        e.container.kendoWindow("title", "Edit User");
    }
}
Greg
Top achievements
Rank 1
Iron
 answered on 31 Jan 2017
1 answer
1.4K+ views

Hello 

I'm using KendoUI Tooltip and attach them by class name, what works fine. There are now situations I have to hide Tooltips. So therefore I thought I can use the hide function of Tooltip but it hides its element as well:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Tooltip hide test</title>
 
        <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.common.min.css">
        <script src="http://kendo.cdn.telerik.com/2015.3.930/js/kendo.all.min.js"></script>
 
        <script>
            $(document).ready(function() {
                // Attach tooltip to all elements with class = mytooltip
                $(".mytooltip").kendoTooltip({ content: 'Enter something here' });
 
                // Hide tooltip on clicking button
                $("#hideTooltip").click(function() {
                    $(".mytooltip").kendoTooltip().hide();
                });
            });
        </script>
    </head>
    <body>
 
        <div id="container">
            <input type="text" id="inputfield" class="mytooltip">
        </div>
 
        <button id="hideTooltip" style="margin-top: 30px;">Hide tooltip</button>
 
    </body>
</html>

 

This code sample does show an input element on which a Tooltip is attached, works fine. If you then press the button that should hide the Tooltip it also hides the input element. What am I doing wrong?

 

 

Marin Bratanov
Telerik team
 answered on 31 Jan 2017
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?