I have a tableview that is of type PFQueryTableViewController and gets its value from Parse cloud. The tableview works fine but now I need to allow the user to:
Select a row
Record in a column (string array) on Parse-Users table what rows have been selected (need to record on parse that - i will use these values for other things later)
When the user comes back and opens the tableview he can see what rows have been selected last time he was in the app
I am not sure if PFQueryTableViewController has any methods ready for that. Could anyone give me some guidance?
I would prefer to use parse cause there are so much stuff out of the box. But if not, that is fine as well.
Also, code samples from similar solutions would be great. Just need to know the best approach.
The table view controller is there for display, it will tell you about selection, but it won't automatically maintain a record of selected items in the back end. You need to decide on the appropriate way to store the selections (array of pointers is better than an array of strings) and update the store and table display appropriately. There is no standard approach to this.
Related
I have created a reorder-able UITableView. I am loading data from Realm, and showing that data into UITableView. My UITableView has Section and rows.
now User can hold Any cell in any section and can reorder them in 2 ways
User can reorder cell with in the same section.
User can reorder cell across the different section.
What I need:
Once the user has made the order he should see same item in same order
when he come back to App. For any type of reordering I have to do
indexing. But I do not have clue how to reorder them in database.
My Idea to resolve the requirement
My idea is to include the String type value in the Model where I can replace something like (1,10) that will indicate section 1, row 10.
But I do not have idea how to tackle this and how to save the reordering as i need here. Any idea about that?? please share
I would like to write a macro that works on the selected table.
Selection in a table
When I select a table, the object that ThisComponent.CurrentSelection returns is of type SwXTextTableCursor. I will refer to it generically as TextTableCursor.
According to DBG_methods it provides methods to traverse through the selected cells and merge or split the cells, but it doesn't seem to provide a way to access the actual table itself. Conversely, ThisComponent.TextTables returns the tables.
As far as I can tell, there is no way to determine if some cells or all of a table is selected.
Question
Is there any way to retrieve the TextTable(s) from TextTableCursor?
To get current selected TextTable use
ThisComponent.CurrentController.ViewCursor.TextTable
Is there any simple way to get the object, used to render given row in CellTable, by index of the row?
I am using AsyncDataProvider, and don't want to remember lists of data objects, returned from the server. Also I am using MultiSelectionModel, so several items could be selected there and I need to track out which one was clicked last.
I know the index of last clicked row, so I need to get the object, corresponding to the row, somehow.
getVisibleItem? possibly combined with getPageStart if you're using paging and you only know the absolute index.
For your use-case, maybe you could use a customized selection model whose setSelected tracks the last change.
I am using searchDisplayController and it would be searching for the names and also the sections. i would like to know how to show the results of only names and not including the section. Assume the codes are the similar as from apples doc. I have at least 2000 names in there when viewing the tableview itself.
See my answer to this question:
UISearchBar Search table row with text, subtext and image
What you show in a results table is completely up to you. It needn't even have anything to do with the table you're searching! (But of course it usually does, as otherwise you'd confuse the user.) You simply form the data that populates the results table; what data that is, is your call.
So, if you don't want to include any section titles, then when the table inquiring of your data source / delegate is the results table, don't include any section titles! It's your code, it's your table, do whatever you want. You are the one implementing tableView:titleForHeaderInSection: to return titles; if you don't want titles, return nil instead. Of course, if the data source for the real table is the same object as the data source for the results table, then tableView:titleForHeaderInSection: will have to examine the incoming tableView parameter to see whether it is the real table or the results table, and make its choice of what to return based on that.
I would like to a bit more of your problem as it is not much clear. I don't actually get this line:
i would like to know how to show the results of only names and not including the section
For searching, it is best to search in a dictionary/array and show the result in tableview by [tableView reloadData].
If i want to insert few rows in the middle of the existing table, how do i approach it? Where all that i should be careful when doing such thing? Is there any good sample source available?
Appreciate your helps.
Thank you.
Tableviews don't contain data and they don't actually contain rows themselves. Instead, tableviews are just an illusion created by redisplaying the same tableviewcell objects over and over again with different data each time. The real table, the real rows, are actually in the logical data.
So, to " insert few rows in the middle of the existing table" you actually add the rows into the data that the table displays. For example, if you had a simple array of names that you display in the table, you would insert the new names into the array. Then you would call -[UITableView reload] which will cause the table to ask the datasource for the new data.
See the Table View Programing Guide for iPhone OS.
Insert the data into your model and call reloadData on the table. If you need to animate the insertion for some reason, you can use insertRowsAtIndexPaths:withRowAnimation:, but the principle if updating the model first still applies.