B4J Question Tableview refresh question after insert record into DB

micro

Well-Known Member
Licensed User
Longtime User
how to refresh a TableView after inserting a record in the database?
Let me explain:
when the program is loaded the Tableview view correct record of a database, but when insert a new record into db and reload with:
B4X:
DBUtils.InsertMaps(SQL1, "Gruppi", lista)
'Now reload db <Gruppi>
DBUtils.ExecuteTableView(SQL1, "SELECT * FROM Gruppi", Null, 0, tablearcdb)

Tableview probably will not be updated because the program crashes, this is log:
B4X:
InsertMaps (first query out of 1): INSERT INTO [Gruppi] ([Id], [N_Gruppo], [Ip], [Nome_Gruppo]) VALUES (?, ?, ?, ?)
java.lang.StackOverflowError
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getIndicesOfParentsWithStylesheets(StyleManager.java:1108)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.getStyleHelper(StyleManager.java:1182)
    at com.sun.javafx.css.StyleManager$StylesheetContainer.access$1300(StyleManager.java:1039)
    at com.sun.javafx.css.StyleManager.getStyleHelper(StyleManager.java:976)
    at javafx.scene.Node.impl_createStyleHelper(Node.java:7437)
    at javafx.scene.Node.impl_processCSS(Node.java:7407)
ecc......

If I close and reopen the program, the record, however, has been included

If you omit this line:
B4X:
DBUtils.ExecuteTableView(SQL1, "SELECT * FROM Gruppi", Null, 0, tablearcdb)
after DBUtils.InsertMaps(SQL1, "Gruppi", lista), the program not crashes
 

micro

Well-Known Member
Licensed User
Longtime User
the first record is inserted correctly...
after no more.
thanks erel
 

Attachments

  • prova.zip
    6.7 KB · Views: 260
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
but I have no set style for TableView and Button in JavaFX
Are you referring to the case for setting DropShadow?
I removed dropshadow for Table and Button and also style settings for the TextEdit but the same crashing.
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
ah ok,
in the code not in FX Designer.
Thanks

......
I edited the css file but not work

B4X:
#tablearcpost .column .cell{
    -fx-font-size: 12;
    -fx-font-weight: bold;
    -fx-background-color: white;
}

where mistake?
 
Last edited:
Upvote 0
Top