Telerik Forums
Kendo UI for jQuery Forum
2 answers
397 views
We are trying to do data binding with multiple levels of function calls in order to tidy our base model (not having all of our functions related to some requirements in our model root's)

So let says our model is as following (expressed in typescript for clarity) :

class MyModel extends kendo.data.ObservableObject {
    EnabledDate() { return false; }
}

and we have a the data-binding expressed as following :

<div data-role="datepicker" data-bind="enabled:EnabledDate"></div>

or (with parentheses)

<div data-role="datepicker" data-bind="enabled:EnabledDate()"></div>
Ok -> These both works perfectly, as expected the datepicker is disabled !

( But please note, strangely :

<div data-role="datepicker" data-bind="enabled:UnexistingEnabledDate()"></div>
 --> generate an error : TypeError: d.UnexistingEnabledDate is not a function

while

<div data-role="datepicker" data-bind="enabled:UnexistingEnabledDate"></div>
--> gives no error, but the widget is not disabled !
)


Now, if we want to tidy our model and group "Enabled/Disabled" in a specialized class, let say :

class MySpecializedModel extends kendo.data.ObservableObject {
    EnabledDate() { return false; }
}
our model becomes :

class MyModel extends kendo.data.ObservableObject {
    private _specializedInstance: MySpecializedModel;

    GetSpecializedInstance():MySpecializedModel {
         if (this._specializedInstance == undefined) {
             this._specializedInstance = new MySpecializedModel();   
         }
         return this._specializedInstance;
    }
}

and our data-bind attribute in markup has to be modified, but we can't find a working way of accessing EnabledDate via GetSpecializedInstance.

We tried the following :
<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance.EnabledDate"></div>
--> no javascript errors, but the binding is not working (widget not disabled as expected)
<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance().EnabledDate"></div>
--> TypeError: e.bind is not a function
<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance().EnabledDate()"></div>
--> no javascript errors and correctly binded, but infinite loop (too much recursion) occurs later on, while it does not occur with the "EnabledDate" working binding scheme

<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance.EnabledDate()"></div>
--> TypeError: (intermediate value).EnabledDate is not a function

We also tried accessing SpecializedInstance as a getter property instead of a function by modifying MyModel class with the following code :
class MyModel extends kendo.data.ObservableObject {
    private _specializedInstance: MySpecializedModel;

    get SpecializedInstance(): MySpecializedModel{
        if (this._specializedInstance == undefined) {
             this._specializedInstance = new MySpecializedModel();  
         }
         return this._specializedInstance;
    };
    set SpecializedInstance(value: MySpecializedModel) {
        this._specializedInstance= value;
    };
}

and the following markup gave the following errors :
<div data-role="datepicker" data-bind="enabled:SpecializedInstance.EnabledDate"></div>
--> TypeError: e.bind is not a function

<div data-role="datepicker" data-bind="enabled:SpecializedInstance().EnabledDate"></div>

--> TypeError: d.SpecializedInstance is not a function

<div data-role="datepicker" data-bind="enabled:SpecializedInstance().EnabledDate()"></div>
--> TypeError: d.SpecializedInstance is not a function

<div data-role="datepicker" data-bind="enabled:SpecializedInstance.EnabledDate()"></div>

--> no javascript errors and correctly binded, but infinite loop (too much recursion) occurs later on, while it does not occur with the "EnabledDate" working binding scheme


So, what is the correct syntax when binding with such multiple functions calls level ?

Thanks for your support !

We are trying to do data binding with multiple levels of function calls in order to tidy our base model (not having all of our functions related to some requirements in our model root's)

 

So let says our model is as following (expressed in typescript for clarity) :

 

class MyModel extends kendo.data.ObservableObject {
    EnabledDate() { return false; }

}

 

and we have a the data-binding expressed as following :

<div data-role="datepicker" data-bind="enabled:EnabledDate"></div>

 

or (with parentheses)

<div data-role="datepicker" data-bind="enabled:EnabledDate()"></div>

Ok -> These both works perfectly, as expected the datepicker is disabled !

 

( But please note, strangely :

<div data-role="datepicker" data-bind="enabled:UnexistingEnabledDate()"></div>

 --> generate an error : TypeError: d.UnexistingEnabledDate is not a function

while

<div data-role="datepicker" data-bind="enabled:UnexistingEnabledDate"></div>

--> gives no error, but the widget is not disabled !

)

Now, if we want to tidy our model and group "Enabled/Disabled" in a specialized class, let say :

class MySpecializedModel extends kendo.data.ObservableObject {
    EnabledDate() { return false; }
}

our model becomes :

class MyModel extends kendo.data.ObservableObject {
    private _specializedInstance: MySpecializedModel;
     
    GetSpecializedInstance():MySpecializedModel {
         if (this._specializedInstance == undefined) {
             this._specializedInstance = new MySpecializedModel();   
         }
         return this._specializedInstance;
    }
}

 

and our data-bind attribute in markup has to be modified, but we can't find a working way of accessing EnabledDate via GetSpecializedInstance.

 

We tried the following :

<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance.EnabledDate"></div>

--> no javascript errors, but the binding is not working (widget not disabled as expected)

<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance().EnabledDate"></div>

--> TypeError: e.bind is not a function

<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance().EnabledDate()"></div>

--> no javascript errors and correctly binded, but infinite loop (too much recursion) occurs later on, while it does not occur with the "EnabledDate" working binding scheme

<div data-role="datepicker" data-bind="enabled:GetSpecializedInstance.EnabledDate()"></div>

--> TypeError: (intermediate value).EnabledDate is not a function

 

We also tried accessing SpecializedInstance as a getter property instead of a function by modifying MyModel class with the following code :

class MyModel extends kendo.data.ObservableObject {
    private _specializedInstance: MySpecializedModel;
 
    get SpecializedInstance(): MySpecializedModel{
        if (this._specializedInstance == undefined) {
             this._specializedInstance = new MySpecializedModel();  
         }
         return this._specializedInstance;
    };
    set SpecializedInstance(value: MySpecializedModel) {
        this._specializedInstance= value;
    };
}

 

and the following markup gave the following errors :

<div data-role="datepicker" data-bind="enabled:SpecializedInstance.EnabledDate"></div>

--> TypeError: e.bind is not a function

<div data-role="datepicker" data-bind="enabled:SpecializedInstance().EnabledDate"></div>

--> TypeError: d.SpecializedInstance is not a function

<div data-role="datepicker" data-bind="enabled:SpecializedInstance().EnabledDate()"></div>

--> TypeError: d.SpecializedInstance is not a function

<div data-role="datepicker" data-bind="enabled:SpecializedInstance.EnabledDate()"></div>

--> no javascript errors and correctly binded, but infinite loop (too much recursion) occurs later on, while it does not occur with the "EnabledDate" working binding scheme

 

So, what is the correct syntax when binding with such multiple functions calls level ?

Thanks for your support !

Ianko
Telerik team
 answered on 06 Feb 2017
1 answer
77 views
If I remove the url property on the data item, behavior is normal.
I've got a jsFiddle that demonstrates the problem here. The last node, 'Carpets' has a url property and can't be dropped and won't fire the drag event.
Ivan Danchev
Telerik team
 answered on 06 Feb 2017
1 answer
128 views
We have an editable grid (angular) that's suffering badly with performance. Our customer reports editing grid cell becomes slower and slower and becomes unresponsive very quickly.

We tried to dig into the problem, and notice the angular watch # increases and digest cycle takes longer to execute as user edit each cell. We use angular expression in cell template, and attaches data-ng-model to the td's attribute. 

Below is demo we created that has similar but much simpler setup as our own grid. It you install Chrome extension AngularJS Batarang, you can use to monitor angular digest cycle time and watch #. You will notice these 2 numbers slowly and steadily increases over time.
https://plnkr.co/edit/s4nhIh?p=preview

It's not too bad of a increase in the above, but our own grid is much larger and much more complicated, and performance suffers badly.

Could you explain why is watch# and digest cycle time increases as I edit cell? It seems to be the <td> DOM is not recreated every time on user enter and exit a cell for edit. 
Stefan
Telerik team
 answered on 06 Feb 2017
1 answer
207 views

I am brand new to Kendo UI. I am curious if it is possible to use a MobileSwitch widget on a Grid to represent a boolean value.  Can we configure the columns of the grid to show another Kendo UI widget?

Where should I go to understand how to build Views that have nested widgets?

Viktor Tachev
Telerik team
 answered on 06 Feb 2017
1 answer
1.0K+ views

Good day!

I know that this is asked frequently, but do you have any options/config to set category labels/axis to auto-wrap?

I know that you can render "\n" as part of the label to have a line break, but in order to do that we have to set a defined length on where to do the line break.

We're making the chart responsive as possible and it will be awkward to look at a chart with a wrapped label when there's a lot of space left.

 

Thanks!

Ollie

Neovation

Dimiter Topalov
Telerik team
 answered on 06 Feb 2017
1 answer
248 views

Hi, 

At the minute when I create a new event the default start/end is in 30 minute increments (see screen shot). Is it possible to set the default to start/end to a 60 minute increment?   

Ivan Danchev
Telerik team
 answered on 06 Feb 2017
1 answer
69 views

Looking in the dojo (http://dojo.telerik.com/anIFa), I made a minor change to the grid to turn on sortable columns.

When this happens, if you sort a column and then also group it, the sort arrows can be contradictory in the column header / group header (see attached).

Is this something that can be overcome?

Stefan
Telerik team
 answered on 06 Feb 2017
4 answers
129 views

Hi,

I have a SPA running in which a users logs on, do all kind of things (showing grids, lists, editing data etc.) against some webservices.

When the user logs off, another user can log on.

When the new user comes on a grid/list/etc. where no data is available on the server, or an error occurs, or even while the data is loading from the server (during the 'wait-cursor-screen') the old data of the previous user is shown! Not a good thing :)

 

So at first I was hoping to build a class in which all datasources can be registered and on logoff I can just set all the data in the datasources to [].

 

Nice idea but since one cannot overload the init function of the kendo.data.DataSource we need to find another way.

 

On each fetch() might be an idea but really unwanted because it means that all fetch functions must be overloaded and for each fetch we must check if the datasource is already registered etc.etc. Takes too much time, so again we need another way..

At this moment I'm a bit of ideas and am under the impression I must be missing something really obvious..

 

Any ideas? Anybody?

 

Best regards,

 

Insad

 

Stefan
Telerik team
 answered on 06 Feb 2017
2 answers
280 views

Hi, Is it possible to have the footerTemplate call a function in the Angular controller?  So in the controller (using controllerAs) you have a function and the template looks something like:

 

                    columns: [
                        {
                            field: "locationCode1",
                            title: "John",
                            width: 200,
                            footerTemplate: "<div>Total Days Worked: #: vm.getTotal() #</div>"
                        },

 

where vm is the controller set using controllerAs and getTotal is the function in the controller.  I've tried #; and #= and I cant get it to find "vm", so it appears its not evaluated in the right scope, maybe there is a field in the scope which will get me to the controller?

Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 03 Feb 2017
3 answers
997 views
Hi,

Is it possible to display all available items in autocomplete widget without changing the source code?

I’ve got something like this, that is an attempt to open the options when textfield receives focus, but it is not working.

 $("#myAutoComplete").kendoAutoComplete({
dataSource: ["Item1", "Item2"],
delay: 100,
minLength: 0
});

 $("#myAutoComplete").focus(function () {
$("#myAutoComplete").data("kendoAutoComplete").search("");
});

Thanks
Doug
oasys
Top achievements
Rank 1
 answered on 03 Feb 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
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?