Case: I am adding a new record to a table.
Goal: Following the add, I'd like to scroll my tableView to the new record. Is this possible?
Alternative: ask user to search for new record.
Alternative 2: set a predicate for the new record, and reload only the new record.
Thanks for any methods/ideas.
Related
I have a table called student and a field in it called miscellaneous. So any items given to the students should appear in the miscellaneous field. So I created and update query with field=miscellaneous
Table= students and update to =[""]&[""]
So on the form I created a btn to run the query and it ask for the value for [""] and after inputting the value and wants to add another one it overwrite the old one.
Will be glad if someone have seen this before
In one form I have system OK button :
#Order(910.0)
public class SaveButton extends AbstractOkButton {
#Override
protected String getConfiguredLabel() {
return TEXTS.get("Save");
}
}
and I have tableField ...
If I add new empty row in this table execStore is called when pressing save button, but if I delete this empty row and press save button nothing is called, button only close form.
How to solve this? I would like to be able to delete empty row.
EDIT :
I figure it out that all rows where only smart fields are filled in, on delete it doesn't detect change. (not only empty rows...)
Problem is that checkSaveNeeded of the form return that nothing was changed in doOk method.
How do you add your row?
You can mark the row as inserted or not. See: addRow(newRow, markAsInserted); on the Table.
You second question is "How does a Table Field computes if the form needs to be stored or not"?
You can implement you custom logic on with execIsSaveNeeded(). See this question on the Scout forum:
https://www.eclipse.org/forums/index.php?t=msg&th=477037&goto=1042295#msg_1042295
Your last point is: when a row has the status ITableHolder.STATUS_NON_CHANGED in an editable table. When the value in a SmartColumn is changed with a SmartField, the status of the row is not changed to ITableHolder.STATUS_UPDATED.
I just tested it and it works as expected.
For row deletion, it depends on how your table field is configured. What is the value of the property isAutoDiscardOnDelete().
The doc here is still valid with Neon: Table > Delete a row from the table
With isAutoDiscardOnDelete() returning true (this is the case if getConfiguredAutoDiscardOnDelete() returns true), when you remove a row in your table field, it is discarded. There is nothing to save because there is no deleted row in the table field (Everything is explained in the wiki section I have mentioned)
If you want to persit a deletion on the server, you should not use discard the row but just delete it. This way you get the information in the FormData and from there you can work with the row status as described here: TableData (again old doc from our wiki, because it works like this since years. This it not new with Neon).
I am trying to add records dynamically to an already populated UITable. In my UITableView class I have a custom List object
List<CustomObject> _data=new List<CustomObject>();
where I add records to from my webservice call like so:
_data.Add(Json(Object));// Json returns a list of CustomObject
//table is a UITableView
//this.table.InsertRows(_data);
I know this above line won't work because its expecting an NSIndexPath[] but I am not sure how to go about adding the new items an load only the new items added. I don't really follow objective C very well so examples I found don't help so much
Generally, you will add data to your List, and then call ReloadData() on your TableView. You usually only call InsertRows() if you want to insert data at a particular spot in the table based on some sort of user action.
You are trying to add a List of CusomObject as CusomObject to a List<CusomObject> ,that is not quite right.you should be adding a CusomObject to List<CusomObject>.
What is the best way to replace a table row in Vaadin (6 and 7)? I use BeanItemContainer. The bean is an entity and has changed (not the ID).
I think this cause unnecessary method invocation and/or object creation:
table.removeItem( item );
table.addItem( item );
As I know, the best pratice is:
BeanItemContainer<DataModel> tableDataSource = new BeanItemContainer<>(DataModel.class);
table.setContainerDataSource(tableDataSource);
When you want to replace a row, just replace the data of this row in tableDataSource:
tableDataSource.removeItem(item);
tableDataSource.addItem(item);
The difference between your code and mine is:
In your code, you replace the row (it means the row is removed from the table and then a new row will be added to table).
In my example, I just replace the data of row.
Hope it helps
I have an NSFetchedResultsController to display a tableView.
And users are allowed to change the cells' order.
How can I record the order so that when users go to the view again,
the table displays by the order modified by users last time?
Thanks a lot!
Hey guys I've done this.
In order to re-order managedObjects fetched by a fetchedResultsController, the most official way I think is to give the entity another attribute of int, such as "order", and give this attribute to the fetch request of a fetchedController, and in table view delegate method "move row from .. to " something like that, deal with this attribute with your hands, and if you use a fetchedController delegate, set a flag in that delegate methods to indicate that you will modity the entity yourself, and notify the delegate to do nothing but return.
Sample codes are Apple Sample code Recipes, and hints on the documentary of fetchedController!