This content has been marked as final. Show 5 replies
It's always a good idea to provide a complete working test case that people can play with.
I can't seem to repeat outside my code.
What I see is that when the observable list is changed, for each entry the cell factory gets called. However whne it gets a row or two past what is visible, instead of continuing to iterate thru the list, it starts again at the top. when I scroll down, I see the repeats. whne I scroll back up, it almost looks like it wrapped in that the old first entry is no longer the first entry?
Suggest something to check?
(I did verify that tyhe Observable List is valid both before and after - i.e. all unique items.)
MiPa is correct... not enough of your code is visible for anyone to offer real help. I would guess your problem lies at least partially outside that section of code. One thing I will note from what I can see though, is that you are doing a bi-directional property bind on that 'item' variable. If the same instance of that SelectRow object is being inadvertently added in multiple places, you could end up with lots of indirectly linked checkboxes. I'm not sure what duplication looks like in your application, but that's the only advice I can think to offer without seeing more.
I'll also note that it's probably not advisable to be using JavaFX in commercial systems just yet; particularly when you're running into fundamental issues like this.
OK finally figured it out,
The ListCell implementation I was using extended another class. That class overrode hashCode(). The implementation of hashCode() was faulty (calculated the hash on a non unique field). This resulted in the odd behavior.
Once I fixed the hashCode() implementation the problem went away.
wasn't that fun?
See my last post