iOS Human Interface Guidance for Changing Table Sort Column - iphone

First post. I'm still reading the iOS Human Interface Guidelines and haven't come across this scenario, yet. When displaying multiple columns in a table, what is the appropriate indicator to the user that they can change the column used for sorting?

Well, the UITableView is a one-column table. So, you can usually not change the sorting. I'd recommend reading the Table View Programming Guide. It says right at the beginning:
A table view has only one column and allows vertical scrolling only. It consists of rows in sections. [...]

I have the same challenge. I'm showing a single list of customers, each having a unique number and a descriptive name. I've added a segmented control to the middle of my toolbar that allows the user to sort by name or number.

Related

How to check if a table will fit in current page or get split up in two pages in itext7

I am trying to create a table in a PDF document with itext7. But, if the content before the table is too big, the table gets split up between current page and next page. I want to insert a -
document.Add(new AreaBreak())
if there is not enough space left in the current page for the table to be inserted completely. However, I have no idea on how to calculate the available space.
Any help or pointers will be highly appreciated.
From your requirement to avoid page-break inside the table, I assume Table#setKeepTogether(boolean) is exactly what you need.
This property ensures that, if it's possible, elements with this property are pushed to the next area if they are split between areas.
This is not exactly what you have asked, however it seems it's what you want to achieve. Manually checking for this use case might be tricky. You would need to have a look at renderers mechanism and inner processing of iText layout in order to get available space left and space needed for the table. You would also need to take care of the cases like if table is to big to be fit on single page. Also #setKeepTogether(boolean) works when elements are nested inside each other.

LWUIT Table, constraint data

I am working in a table with multiple data inside. When I add only the header, I can see the data in a good way, and the columns with different sizes.
But when I add the data, all the columns go crazy, the widths are adjust to the headers, and the data dissapear.
How can I get to show every data in the proper way?
You need to derive table and override the method to create a cell then after a call to super set it to not end with 3 points.
You can also override the create constraint method and define percentages for the specific columns although this might not look good for all resolutions.
As a side note we made quite a few improvements to Table in Codename One and integrated basic Asha support as well.

how to combine two UITableview in single UITableview's section?

I want to set two different UITableview in single UITableview's particular section. Is it possible??
To do exactly what you are asking is not possible. but I think that you did not phrase what you want correctly.
You probably want to show data from 2 different table views in one section. As you probably know each tableView has a Data Source. All you got to do in order to show data from the 2 tables is to manipulate the Data Source to return exactly the data you are expecting, i.e. joining the 2 data source content for this section together.

Proximity in a Table View?

I'm programming an application that lists a number of locations. I have the coordinates stored in a .plist, which I am using as a data source. I have trouble figuring out how to conceptually approach problems, so some help would help :)
I would like to Have the name of the location sit on the left while on the right of the table view, you can see how far away from the location you are (in miles / kilometers). Is there a convenient way to push this information to the table and sort the list?
You will have to port your plist data into a datasource NSArray for the UITable. You can use sorting functions of NSArray to sort your data at anytime and do refresh on the table. B/c you want non-standard data in the table cell you will have to design your own custom UITableCellView. You can find lot of examples on Stackoverflow on how to create custom cells and do sorting.

How to use UITableView when total number of sections and rows are unknown (and potentially large)

Normally to use UITableView, the number of sections and rows per section are known. But what if they aren't? I want to implement a lazy search, so that I actually search for the next match when new data needs to be displayed. Something on the lines of: db.prepareSearch(query) and then call something like db.nextSearchResult() when it is time to display a new cell. The search result determines if a new section is required or not (search results are inherently sorted).
Not sure why it wasn't done this way to begin with, so that it asks for a section until no more are available or needed, and for cells in the section until no more are available or needed, instead of having to specify the totals, which implies having to finish the whole search before starting to display the first few results.
To get the number of sections and rows, it's easy -- ask your data source. If your data source has no way of telling you this, make a way.
For instance, if you have to query a table and ask how many rows there are for your sections, do that. Then, for each section, ask how many rows there are which match that section.
What it also sounds like is you want to paginate your data. Meaning when you get to a certain point, have a "load more data" cell or some-such. This is fine too, just add a sentinel node to your data source, and whenever that particular item comes up, display your alternate cell while you load your data, then remove it after your next data is fetched. I do this in a few of my apps.
If I'm understanding this correctly, at the point of drawing/populating, you will know how many rows/sections you have.
If your changing the underlying data using db.nextSearchResult() then you must be calling [tableView reloadData] to trigger a UI update, at this point you should know how many sections and rows you have.
I have to admit I'm a little confused to the exact issue here.