JPro-one / JPro-Platform

Represents the foundation of cross-platform application development, seamlessly integrating the power of JavaFX with the limitless potential of web-based applications running via JPro.
Apache License 2.0
21 stars 3 forks source link

Is TreeShowing is not working fine with javafx table-view? #1

Open ctoabidmaqbool opened 2 years ago

ctoabidmaqbool commented 2 years ago

I think, somehow it's not better working on table-veiw. because many time items removes and added up again.

e.g. when scroll up / down.

for testing use this code:

https://stackoverflow.com/a/22603187/10606381

set a listerner on pane to see the issue!

ctoabidmaqbool commented 2 years ago

image I need workaround for table view, if possible

FlorianKirmaier commented 2 years ago

The question is, what behavior do you expect? When you scroll up/down, elements are dynamically added/removed from the TableView, therefore the listeners might get fired regularly. So it's the expected behavior to get many events on scrolling. Is this the behavior you get? What are you trying to achieve?

ctoabidmaqbool commented 2 years ago

@FlorianKirmaier Thanks for reply!

Actually I am using jfoenix -> JFXAutoList component, with my own custom codding! And I want to make it null when my Textfield (on which dropdown auto list suggestion is applied) is destroy.

In normal cases is working as expected. e.g. when my form closed, textfield destroy then I set jfxautolist to null using jfx-utils listener.

But in case of tableview when i scroll down, listern executed which set null value to autolist but when i agaain scroll up, dropdown not works as is becomes null.

Note: I want to executed TreeShowing.treeShowing(txtBatchNo).addListener((p, o, showing) -> {}); when actualy row is deleted e.g. not virtualy when scroll is up & down but when deleted e.g. by button or codding.

ref 1: image

ref 2; image

FlorianKirmaier commented 2 years ago

Hm, at least it's not a bug in the treeShowing property. The question is, whether treeShowing on the cell, is what you want. The treeShowing property can switch between true and false multiple times, so when you use this property, you should support "reenabling the node". Or you could set the listenr on something else - for example on the TableView.

If you want to execute it when the data is deleted, maybe set a listener on the items of the TableView, checking whether the element is removed?

ctoabidmaqbool commented 2 years ago

@FlorianKirmaier How can set this listener in table view element (row)? I have tried everything's, also search a lot but could not find anything useful. Maybe TreeShowing.treeShowing().addListener() can't be applied to Tableview's items because it accepts only node, and table item is consists of only Model.

FlorianKirmaier commented 2 years ago

You could add a listener to the TableView.items, and if something is removed from the items, then you dispose the specific Node. But that's probably tricky. Or you add the listener to the TableView itself. Or you rewrite your logic, that you can enable/disable your node multiple times.