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

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)

Related

Add empty rows in a tableviewer

I want to use a "Add" button to add empty rows in the table using table viewer. After adding a new row, the user can edit it. How can I implement this design? Thanks!
You should add the rows to the data that your content provider returns in the getElements method using something that the label provider will show as empty. You then call refresh on the table.
For editing you will use the normal EditingSupport and make sure it can deal with empty entries.

Updating slickgrid autocomplete fields without rerendering the grid

I'm using SlickGrid in a sharepoint environment to display and update data. To save on the the load time, I am populating auto complete fields with options that have only been used in previous lines (with tables with more than 50 lines), and then I am wanting to give the user the option to click on a "Metadata refresh button" located at the top of the autocomplete fields that will go and fetch all available options to repopulate the auto complete field.
<table><tr><td>[ TextField ] </td><td>[ AutoComplete1 ] </td><td>[ AutoComplete2]</td></tr>
<tr><td>Entry1</td><td>Hello</td><td>Goodbye</td></tr>
<tr><td>Entry2</td><td>Hi</td><td>Later</td></tr>
</table>
So if, the user was to create a new line, they would have the options of Hello and Hi in column 2, and Goodbye or Later in column 3 to choose from since they have been used before. If they want the option "Hail!" to appear in column 2, they would have to click the "Update MetaData" button for column 2, which would refresh ALL the cells in that column with all available but previously unused selections.
I know its not ideal, but its a requirement that has been given to me.
I know how to add buttons to column headers and I am updating the array of data that the grid needs for the autocomplete column, but I am at a loss on how to update the column choices without redrawing the whole grid.
Any suggestions?
Check out the newer examples in my repo: https://github.com/6pac/SlickGrid/wiki/Examples
This is probably closest to what you want:
http://6pac.github.io/SlickGrid/examples/example-autocomplete-editor.html
What I have done in the past is create a data property of the cell node to store the object, like:
$jqacContainer.data('queryautocomplete', jqac);
It's then easy enough to get the object from the cell node.
However, this requires proper cleanup of the property to avoid a memory leak. This should be able to be done in editor.destroy(), but I don't think I've checked corner cases, for example where the editor is scrolled offscreen before being completed.

Change per row value in Core Data

I have a table shows all the data in Core Data. And I created two swipe action button in each row. I know how to delete each row value, but how can I managed to edit one attribute value while pressing another button, like plus one value in it. Thanks.
In the button handler, increase the attribute value by one. But you could have figured this out yourself. ;-)

scala, swing : make a table scroll to the last row non empty

I would like to be able to add a row in a table, to achieve this I thought to a button near the table, with the caption "New/Update". if no row is selected, then clicking on this button makes the table "scroll" to display the first empty row, then the person enter the informations in this row, and a second click on the button stores the new row.
But I need to make the table scroll, how can I do this?
I searched on internet and found this : here, but it is in Java and I did not find the scala equivalent to getCellRect method.
please note I did not used a model for the table.
If there's a method that isn't implemented in the Scala version, you can use peer to access the underlying Java Swing version.
So you should be able to access the method in your question, if you have a Table t, using t.peer.getCellRect.

A treeview INSIDE OF a treeview? or how to show a list inside of a treeview

I have a treeview that lists the properties of an object. One of those properties is a list of Tags (strings) that can be a list of zero to whatever number of items. So you could tag a song with "Jazz" and "Favourite" and "Chillout" or whatever. At the moment I have these implemented as just a single string with commas separating each tag but I'd like a more intuitive user interface. All of the other properties are shown in a 2 column treeview where the first column is the property name and the second column is the property value.
It thought one way to do this would be to place another treeview inside the second column in the tags row where users can click a row to edit/delete it or there's be a "Add new tag..." row that lets them add new tags.
How could I possibly do this? Alternatively, any different GUI suggestions?
You cannot put widgets (GtkWidget) inside a column of a treeview. But you can pack several cells (GtkCellRendenderer) into a single column. A cell renderer is kind of like a lightweight widget. It can of course be subclassed so you can write your own if nothing else fits your needs.