Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kendo controls cannot be used from bind() or attached() #795

Open
davidsk opened this issue Jun 15, 2019 · 3 comments
Open

Kendo controls cannot be used from bind() or attached() #795

davidsk opened this issue Jun 15, 2019 · 3 comments

Comments

@davidsk
Copy link

davidsk commented Jun 15, 2019

The documentation states that

Kendo controls cannot be used from bind() or attached()

Does this refer to when using aurelia-kendo-bridge or in general? I was under the impression that one of the advantages of Aurelia was the compatability with 'vanilla' libraries.

@JeroenVinke
Copy link
Member

Hey.

Some Kendo controls get odd behavior when you initialize it on an element before that element is attached to the dom. So the bridge initializes kendo controls from the attached lifecycle callback. Unfortunately the attached callback on the viewmodel is called before the attached callback of child components, such as the bridge components. That's why you can't access the kendo controls from attached because they are not initialized yet. I recommend using the k-on-ready callback as mentioned in the docs, that way you know for sure the control is initialized

@JeroenVinke
Copy link
Member

Most controls can be safely initialized from within the bind callback of a custom element, which means that you can use it from the attached callback of your view model. Kendo is one of few which you can't initialize from bind without getting weird issues

@jlipford
Copy link

I have also had success that if a control needs binding after attached, utilize a custom plugin that adds "after-attached" callback. Unfortunatley it is not in npm and only jspm format but you can easily get around that. https://github.com/aurelia-ui-toolkits/aurelia-after-attached-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants