Link to home
Start Free TrialLog in
Avatar of butterhook
butterhookFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Knockout .js applying bindings to large model - timeout and uncatchable exception

Technology stack:

* JDK 1.8u25
* KnockoutJS v3.1.0
* JQuery 1.9.1
* WebView and WebEngine

We have an object in our Java environment representing a structured document. Using Java 1.8 u25.

We wish to render it in a JavaFX WebView using custom Knockout.js bindings.

When we call ko.applyBindings() on the model, we get results as follows:

When the number of ‘rows’ in the data structure is < 400, the document renders successfully.

When the number increases beyond this point, we never get past the ko.applyBindings() line in our initialising function.

We don’t appear to get meaningful, if any catchable exceptions with Knockout.js - the document fails to render and gives us some very unexpected output e.g. the output for a context which isn’t in the model.

We don't have this problem when we run the same function in the browser (Chrome)
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Posting JavaScript questions in the Java TA is not appropriate, and might make your question less likely to be answered. http://technojeeves.com/joomla/index.php/free/127-javascript-is-not-java
Avatar of butterhook

ASKER

Thanks CEHJ for the suggestion - however as you can see we are using Knockout.js inside a WebView component of a JavaFX project so it is actually relevant, as the problem we are facing is inside that environment rather than a browser.

Also we are well aware that Javascript isn't Java.
Apologies in advance if I ask too many questions regarding the java side of things as my background is javascript and knockout.

What version of javaFX are you running?  It seems that 2.2+ is required for HTML5

When the number of ‘rows’ in the data structure is < 400, the document renders successfully.
Is the 'rows' an observableArray?  It would help to see the model (if only the relevant parts).

Is it possible there a memory restriction for any javascript objects within the WebView/JavaFX?
Hi Rob, Thanks for getting back to us.

Yes, the 'rows' are part of a model. Will see if I can get you the relevant parts as soon as I can as well as the info regarding JavaFX version.

Yes, all our evidence points to the memory restriction for Javascript objects within WebView/JavaFX.

Would you expect a memory restriction in the browser environments you work in?
Thanks that info will be good to know.

Yes there are memory limitations but they are not so much of an issue as they are only limited by the operating system and hardware of the client machine. Both of which outstrip anything we would need to do in the browser.
That's not to say they wouldn't crash.

I have a fairly complex model that I use daily,  with upwards of 200 items in an observable at a time. At times it runs slow but more so on my phone and tablet rather than my laptop.
Hi Rob,

The JavaFX version is bundled with JDK 1.8u25.

Will get back to you with parts of the model when possible.

Charlie
Hi Rob,

Are you familiar with Java development, as we have a test case project created? Or is your expertise mainly web and browser?

Charlie
Hi Charlie

Unfortunately, it's web based development. It's been 10+ years since I used java (basic structures, applets, forms etc)

Happy to help but understand if you want to get other java specific programmers involved.  In fact, there's another expert I'll ask if they can take a look too.

Rob
Still looking into this - will post updates when we have some, in the hope that we will help someone else!
I'd also suggest Requesting Attention to get a moderator to send out alerts to other experts.
Thanks for keeping an eye on this Rob - did you ask the other expert you were considering?

Many thanks!
Sorry things got a bit crazy around new year but I've since sent the message.
(y)
@butterhook,

I was asked by Rob to look into this from a Java perspective but unfortunately, I don't have any experience with JavaFX and WebView, and so I don't think I can be much help.

we have a test case project created
Just to clarify, are you saying that you have a self-contained example that demonstrates the issue that you are seeing? If so, it still could be worthwhile posting it here for us to look at.
Not sure if this helps but it seems that there is an API written specifically to include knockout and its implementation: http://bits.netbeans.org/html+java/dev/overview-summary.html
Thanks all - I believe we have found the source of the issue and will update the thread in due course.
Great news. As an avid knockout developer I'd be keen to hear what's fixed it.
ASKER CERTIFIED SOLUTION
Avatar of butterhook
butterhook
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
We managed to manage the bug by working round it.