JavaFX - TableView, How to add new row to the control? - row

Does anyone know how to add a new row (to add completely new data) to the TableView - directly to the control? Editing is quite easy, but how to add new data?
I thought this should not be a problem (as I know this from other prog. languages), but on the entire internet I have found only this one related topic posted a year ago which is not answered still. Is it imposible to do this in JavaFX?
JavaFX 2 TableView inserting rows directly on the control
Thank you very much.

TableView is backed by an items list, add a new entry to the items list and a row corresponding to the entry will be displayed in the TableView.
tableView.getItems().add(new Item());

Related

Best way to make a list of rows and column in wxpython with each row having buttons in last column?

I want to make a list of n rows with m columns. Last column must contain a button which on clicking deletes the entire row which that button belongs to.
Click here to see my desired GUI.
I have already looked for wx.grid and didn't get any success.
My questions are
Can this be achieved by using wx.ListCtrl?. If yes then how?
Which is the best wx widget other than wx.grid to achieve this.
Any sample code or illustration will be appreciated.
Thanks

Qt - Can Several QtableWidgets share linked Items

Qt Several tableWidgets share linked Items
Hi, in Qt I have a QMainWindow -> centralWidget (QWidget) -> QtabWidget -> then 10 Tabs (QWidgets) -> each with up to 26 QtableWidgets:
Sample 1
Sample 2
The idea is that instead of this:
void MainWindow::on_pushButton_Add_Player_clicked()
{
ui->tableWidget_Players->insertRow(ui->tableWidget_Players->rowCount());
ui->tableWidget_Defensive->insertRow(ui->tableWidget_Defensive->rowCount());
.
. [10 tableWidgets in Total]
.
ui->tableWidgetAll->insertRow(ui->tableWidget_Players->rowCount());
}
Is there a way so that I can add a column each time to every tableWidget with less code.
Of course that's not there is to it, in fact I want to know is there is a way to link some of the Items of each that are actually the same Item but it's repeated in each like for example the Player Name is the same per row in each tableWidget, so if the user edits the name in one, it should change it in the same row in every tableWidget.
Is there a way to link them somehow, or the only way it's checking for item changes as signals.
I would also like that if I sort by column in one tableWidget, the new arrangement of the rows should be the same in every tableWidget.
Can anyone point me in the correct direction, the only idea I have it's using signals for ItemChanged. Isn't there a better way?
Thanks a lot for your time.
If your tables are the same data, you should consider getting some nice model view controller action going (also say that phrase a lot when applying for jobs, they like that ;))
To do this you need to create a tablemodel. And a TableView widget. This way, the data is shared, so it exists in only one place. All your TableViews just show the data. You can have a look at QSortedFilterProxy to filter your data for a specific view(i have never used this, so don't know). That way you have your playerModel somewhere, and each view has a proxyModel that only shows for instance the active players.

How to make specific column items in the list control to be editable?

I am having a listcontrol which intern consists of 4 columns.Now I wanna edit second column items in the list.How can I make it editable?I have seen many samples in code project and in many other forums ,In none of the forums I was given an simple solution.I can make it done but it is time consuming (by debugging),Is there any simple solution to make a specific column items in the list to be editable.(For Instance I want all the items in the second column to be editable)
Any suggestions can be appreciable..
This is your quick solution with in-place editing of all columns: http://www.codeproject.com/Articles/8112/CQuickList

QTableWidget - combobox delegate how do I allow different options per cell

Aloha
I have a QTableWidget with two columns that are currently using a ComboboxDelegate (my subclass of QItemDelegate) to present options to the user. I'd like the choice in the first column to effect the options available in the second, for the current row only.
E.g have a list of cars in the first column, and in the second a list of colours which are available for that car. Other rows to have different cars selected and thus different colour choices available.
From what I can see, I can only set an item delegate per row or column, so I can't see how to change the options in the second column's delegate without affecting all the other rows.
Is this possible? I'd really like to avoid going to a full view/model separation as I have quite a bit of code looking at this QTableWidget already (and I'm under time pressure)
Well for those interested; I went back to my pre-delegate approach, which was to use QTableWidget::setItemWidget() to provide a combobox widget for each cell.
I subclassed qcombobox to take a reference to the table, and connected the combobox CurrentIndexChanged with a slot to update the table data.
(setting a widget in a cell does not affect the tablewidget data unless you do this).
Using a full combobox like this is more expensive than an itemdelegate, but my tables are very small so I can get away with it. The rendering of the combobox is not as nice as the delegate (the combobox is visible all the time instead of only during editing in the delegate's case), but with time I'm sure I can improve on this.

Infragistics WebDataGrid column layout not maintained on Insert and Delete

I've come across this weird issue with the Infragistics WebDataGrid control.
When the grid starts, it appears ok, headers on the header row. There are no entries, so the only row displayed below is the "add" row.
I then load data into the grid from my AJAX code-behind. It appears ok. The 3 new rows appear, the "add" row sits below. Everything clean.
I then click the delete "x" in the 2nd row (sidenote: this is a template column and is the first column in the grid, so why it appears at the end I do not know). The AJAX kicks in and the 2nd row is removed. But the grid refreshes odd. It looks like a new column has appeared on the "add" row, which has thrown the other rows and header out.
It is functionally correct, but visually a mess.
NOTE: This also happens when you add a new entry from the "add" row.
FYI - I have followed pieces of Craig Shoemaker's example, however I bind my datasource in the code-behind, amongst other changes. (http://community.infragistics.com/aspnet/articles/webdatagrid-client-side-crud.aspx).
Anyone know what causes this / how to fix it?
Chris,
I tested this and I wasn't able to reproduce this. I would recommend that if you can still reproduce this you post the issue on the Infragistics forums with the code that you are using so that we can look into it further.