Skip to content

Conversation

@JohnEricson
Copy link

Solves "TypeError: Cannot read property 'length' of undefined" error when using slider connected to datasource in CDE dashboard. The cause of the problem is that sliderData.resultset.length is executed before sliderData = values, resulting in the slider failing to render on start of the dashboard.

Complete error:

CDF: Error updating render_SliderYear:Dashboards.log @ Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:82
    (anonymous function) @ Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:403
    setTimeout (async)Dashboards.updateLifecycle @ Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:415
    Dashboards.updateComponent @ Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:459Dashboards.updateAll @ Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:1127
    Dashboards.initEngine @ Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:880(anonymous function) @ Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:690
    fire @ jquery.js?v=08c235d357750c657ac1db7d1cf656a9:1037
    self.fireWith @ jquery.js?v=08c235d357750c657ac1db7d1cf656a9:1148
    jQuery.extend.ready @ jquery.js?v=08c235d357750c657ac1db7d1cf656a9:433
    completed @ jquery.js?v=08c235d357750c657ac1db7d1cf656a9:103
Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:85
    TypeError: Cannot read property 'length' of undefined
    at BaseComponent.extend.update (ionRangeSliderComponent.js?v=47871653d5a1943b738b951940888bc8:48)
    at Object.<anonymous> (Dashboards.Main.js?v=8e89e10f9ca55858977d99c20148f7a6:378)

…rror when using slider connected to datasource in CDE dashboard. The cause of the problem is that sliderData.resultset.length is executed before sliderData = values, resulting in the slider failing to render on start of the dashboard.
@JohnEricson
Copy link
Author

My bad! This doesn't really solve the problem. Now it uses the hardcoded minRange, maxRange in properties instead of taking them from the datasource query.

JohnEricson added 2 commits September 1, 2015 14:07
…'length' of undefined". Earlier my solution disabled fromRange, toRange from datasource. Now I solved this by triggering the rest of the rendering code of the slider after the data is retrieved successfully. Code is inspired from CDF components.
@JohnEricson
Copy link
Author

Now I've fixed so the solution works with datasource queries as earlier. I would like this fix to be pulled into master.

@latinojoel
Copy link
Member

Hi @JohnEricson,

Thanks for your contribution. 😄 I'll give a test soon.

Joel

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

Successfully merging this pull request may close these issues.

2 participants