NatTable - Newest row first - nattable

Is there a default flag that can be set in NatTable to allow the newest added row to appear at the top of the table? Or do I just directly add the row to the beginning of a backingList that is maintained by the EventList? Or do I add it to the sortedList/filterList layers? Or is there another preferred way?

There is nothing special for that in NatTable. You can solve this either by ordering (add the newest item at the beginning) or sorting (find some attribute that can be used to sort the list in the way you want)

Related

sap.m.Table removeColumn does not delete the corresponding items

If I remove one Column using a sap.m.Table from a standard view the corresponding items are still available. The problem here is that the ordering is wrong after I delete a column here.
Lets say I want to delete the "Historie"-Column, the corresponding items are still available. How can I delete one column with the items of one column here?
The problem here looks like that:
As you can see in the picture below I have deleted some columns and also the "Historie"-Column. The corresponding items are still available.
How to solve this and delete the matching items here using sap.m.Table?
I tried to remove the Columns by removeColumn(oCol) from the API: sap.m.Table
I think this is a bug with sap.m.Table.
For your problem, you can use the visible property of column to hide the column from view. Though it will not remove the column from the table.
var oTable = this.byId('idTable');
var oDeleteColumn = oTable.getColumns()[0]; //fetch the column you want to hide
oDeleteColumn.setVisible(false);
removeColumn() removes the column only from the table's <column> aggregation, but not from the data.
If it is an option for you, than use Table Personalization:
Table personalization can be used to modify the display and settings
of a table.
It is a UI pattern that is used to change one or more of the following
attributes:
Visibility of columns
Order of columns
Sorting
Grouping
Filtering
Sample

How to implement new item of sap.m.Table in Fiori?

I want to implement new item(row) in sap.m.Table. In Add Items section of Fiori guideline, it looks like this:
Here is my Demo
I have three questions:
How to add the new row to the first item of the table?
How to "highlighted it with a visual indicator"? (the left blue part in design)
Why addOneRow function did not work before setModel? Is it because data binding refresh the table or sth.?
1- The way I addressed this problem in several project is by using 2 tables : first tables only contains one fixed row and the second one is binded to an array. When clicking the 'add' button in the first table it resets the first table content and adds an item to the second table binding
2- the hightlight property is on the items. example:
<ColumnListItem type="Detail" highlight="Error">
if you use my solution from #1 you might use it only on first table
3- you're totally right, this is also why you should put your 'addOneRow' in the 'onAfterRendering' callback to make sure your last row (that you likely always want) is always displayed.
(btw if you use solution from #1 you simply dont need it anymore)

How to Create a Multi-Column Custom Content Element

I'm trying to create a custom two-column content element in Typo3 Neos. I'm aware that Neos is shipped with multi-column functionality, but for this particular case I need to create my own custom content element.
So far I've been able to create one of the columns (see below gist for code). However, as soon as I try to add the second column, the page just turns blank and no further changes can be made.
Gists
1 column activated (working properly): https://gist.github.com/anonymous/c5f33c7923faae26aa1a
2 columns activated (not working): https://gist.github.com/anonymous/85fc6994e9e2c5892a11
Any idea why that is happening, or how to solve this / build a multi-column custom content element in Neos?
I found the solution! I simply had to execute the following flow command to create the missing node:
./flow node:autocreatechildnodes --node-type Daniel.MultiColumn:TwoCol

How to remove the sort indicator in GtkTreeViewColumn keeping the column sortable?

I know it's a bug that is considered not an issue but when you have many columns that you still want them sortable, all displayed without the need to scroll right and left and the sort arrow indicator is not so important. What are available workarounds?
I found it can be done by not applying set_sort_column_id to the treeview column. We must do it programatically through using set_clickable method to the the column that you don't want an arrow to be displayed in its header, then using signal_connect to the clicked signal and bind it to a function which will use get_sort_column_id of the model to get the current sort order whether GTK_SORT_ASCENDING or GTK_SORT_DESCENDING then apply the reverse sort order using set_sort_column_id on the model.

ColumnSorting with AsyncDataProvider - how to find out which column the user wants to sort by?

I am implementing a GWT CellTable with paging and sorting by multiple columns dynamically.
The basics can be found in the CellTable Developer's Guide.
However, the dynamic example does not tell how to find out by which column the user wants to sort (it simply sorts by the 'name' column). That's not enough in my case, as I want to allow the user to sort by different columns.
The only solution I could think of, which is not very elegant, is to keep track of which column is sorted in ascending order or not (using table.getColumnSortList(indexOfColumn).isAscending()) and then figuring out which one has been clicked by comparing the values for each column (the one that changed is probably what the user clicked).
This involves keeping information in my classes that should be available somewhere in the CellTable! But I can't find that information!
Thanks for any help.
I found the answer. As explained in the javadocs for com.google.gwt.user.cellview.client.ColumnSortList:
An ordered list containing the sort history of Columns in a table. The 0th item is the ColumnSortInfo of the most recently sorted column.
So, to know which column was last sorted by, you simply do:
ColumnSortInfo info = table.getColumnSortList().get(0);
Column<Type> sortByColumn = info.getColumn();