i have several Tables which display things like products which are saved in a database. So to get this products displayed i get a list from the database and give the list to the tablemodel.
Now i want a delete button in every row with which i can delete the product from the database.
Are there some good ways to do this? Right now i have implemented something that feels wrong. I have custom button which saves its row when its initialized and that makes a callback from the table (custom class extending jtable) to the view which then calls the controller to delete the entry from DB.
Check out Table Button Column by #camickr.
Related
I need to get all values from JFX Table View. Tell me to way for that. it's very important to me. below has that table.
If you want to get all items in the TableView you can use the getItems method. Otherwise if you want only the selected data, you can use a SelectionModel to get the selected item.
I'm a beginner android developer. I am creating an app but having trouble to get a rough outline for my next task which I am going to explain below. I am not asking for code. I just want to know the best way to do the below.
I have an Activity that displays a RecyclerView with a list of items like this:
My question is related to the 3 checkboxes.
How should I approach creating the layout in the pic? Do I have to include 3 checkboxes and 3 booleans in my main object class? The other items in the object class are saved in SQL database and the RecyclerView in the activity gets its data from there using a cursor. Can the value of the checkboxes be retrieved using the cursor?
Do I create a separate sparseBooleanArray for the checkboxes? Do I create a HashMap for them?
Should I store the value of the checkboxes (Checked/Not Checked) in SQL or SharedPreferences?
This is basically an opinion based question and hence I am throwing some suggestions on how you should implement it. If I have understood your problem correctly, you have provided a single list item in your RecyclerView and the items are being populated from a local sqlite database table.
Hence there are three checkboxes for each of the list item and yes, of course you need to save the states of the checkboxes in your sqlite table along with the information of the list item. I do not know about your current table structure. However, the pseudo implementation of your updated table structure may look something like the following.
item_id description checked_status
----------------------------------------
1 Some desc null (Not checked)
2 Some desc LOCK
3 Some desc DONE
4 Some desc NOTIFY_ME
Hence when you are clicking on your checkbox, you need to update the sqlite table accordingly with the newly updated data for that specific row and update the RecyclerView items accordingly.
I am trying to create a feature in my program where the user can click on one row from the Jtable to select it (Jtable is populated by data from the mysql table). Then, the row will be copied to another mysql table that is identical in terms of names of the columns. What is the simplest way to do this? I am somewhat familiar with SQL queries but I am not sure how to implement the part where the user clicks on the row in the jtable.
I am trying to implement a Jtable which includes three check-box tables like this:
Can you tell me how to set a single selection group of checkboxes which only allows 1 selected check-box in a single row at any time?
I know of nothing out-of-the-box for doing this. I´d have a TableModelListener check these columns every time a change is made and call setValueAt on the checkboxes as needed.
I have been working on JTable,
My project:
read data from database (I finished this task and able to display in JTable).
then display and save data into subgroups into file (text/excel).
I have basic knowledge on JTable and using the some example code, I could manage to finish my first task. Then struck on second task.
for example
name| email|
name1|email#email.com
name2|email2#email.com
(I finished this task and able to display in JTable)
Then
when user clicks any row
then displayed new table
name|Email
display----
then user should able to save the group with groupname
Can anyone has idea about how to update the table dynamically and any suggestions?
Can anyone has idea about how to update the table dynamically and any
suggestions?
If you are using DefaultTableModel then you have methods like addRow(..) which will append a row in the JTable. Updating the existing rows in JTable is done using setValueAt(..) method. No need to call fireXXXMethod for DefaultTableModel.
Or
If your are using AbstractTableModel then use the setValueAt(..) method and call fireXXXMethod in the table model to refresh the table data.