Table with sort using column Headers in UI5. Table sorter - sapui5

I would like to provide table sorter i.e possibility to sort the table by clicking on a Column. For Example: Product Name column shows the possibility to sort. https://openui5.hana.ondemand.com/#/sample/sap.ui.table.sample.Sorting/preview
I want to do a similar thing in sap.m.table as I see sap.ui.table is not valid for phones according to https://openui5.hana.ondemand.com/#/api/sap.ui.table.Table/overview
Can I achieve this in some way? Or any insights on any alternative approach I can take?

Related

Merge columns with identical values in a smart table (responsive table)

Is it possible to merge duplicates in a sapui5 smart table?
In a smarttable (with a responsive table) we are grouping values by supplier and would like to merge duplicated values into one cell to get a better readability of the responsive table.
Outside of Fiori elements (smarttable) this can be done in the column definition in XML using mergeDuplicates: true.
Should be possible to merge duplicates via SAP UI5 Visual Editor, the properties of controls are available there.
Not all properties are subject to change. Only properties that have been enabled for editing may be changed.
Best,
Shanir

DOMINO REST API get Collection sort column

Hi I'm trying to get a sorted Collection from the Domino Rest Api. My database name is "Test/JSON_Views.nsf" and my views name "List".
The endpoint I use is
**/Test/JSON_Views.nsf/api/data/collections/name/List?sortcolumn=title&sortorder=ascending&count=20
But the JSON-Response entries aren't sorting by title in ascending order.
Should I make any settings to the column properties in the designer? If I set descending there for the title-column it works. But I want to change the sorting in my external java-application.
Is my endpoint correct? I use this Domino API Docu as Reference.
Add an additional sorting to your title column:
This gives the API the possibility to sort by title in both directions. You can do this with other columns too so you are very flexible in sorting this way.
The doc says that if the column isn't sorted in design then the sortcolumn parameter has no effect, so the answer is "Yes" you should change the design of the desired column. If doing that is unworkable in whatever context you use it, then create a second view and use that instead.

SAPUI5 table: get none-displayed values of selected row?

I have a SAPUI5 (OpenUI5) application with a table. This table is bound to a (JSON) model and display the name of the entity and some other attribute - but not the technical key.
The user should have the opportunity to select multiple lines in the table and the application should then be able to get the technical keys of the selected lines (probably using the underlying model).
How would I do such a thing?
Thanks in advance!
The rowSelectionChange event has a rowContext attribute. A better approach would be
rowSelectionChange: function(oEvent) {
console.log(oEvent.getParameters().rowContext.getProperty("your_key"));
}
to obtain the value of your key (or any field in the selected row by adapting the getProperty value accordingly)
when you will select a row in a table, there is a event called "rowSelectionChange". Use this event and getSelectedInedx of row.
Using the index value loop over your json and get values selected row.

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();

Spring 3 multiple values in checkbox tag

I have a database table which does not contain a primary id and I need to delete rows using two values in a table so that the row is unique.
For each result row displayed on the jsp I have a checkbox for it.
I need to find out if I can do something like this where I post two arraylists via spring form tags?
<form:checkbox path="valuesList1" value="${object.value1}" path="valuesList2" value="${object.value2}"/>
Thank you very much.
This is not supported, however you can combine your values into one using special separator, e.g. ":::" and then split them back in your controller.