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.
Related
My e2e-test for ui-grid is the following:
I'm adding the new item with the name that includes timestamp, saving it to the server.
I'm checking if the item with this name has been added to the ui-grid table.
The problem is that the table can get very big and ui-grid apparently uses lazy loading and puts only the visible rows to the DOM. I found this library of helper methods for testing, but it doesn't provide anything to search for the rows which are not in visible now.
So, question, is one of the following is possible in my Protractor test?
1) can I check how many rows do I have in my ui-grid table?
2) can I search for the certain cell by text, even if the cell is not visible?
1) Can I check how many rows do I have in my ui-grid table?
As long as the row is in the DOM, you can access it. However, if it's not visible you won't be able to do any operation on it (e.g. click). To get number of table rows you can use count:
$$('table tr').count();
2) Can I search for the certain cell by text, even if the cell is not visible?
Yes, you can search for (but not interact with) the cell as long as it's in the DOM. It doesn't have to be visible. But selecting elements by their text is rather fragile, so you should try to use some other method, if possible.
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.
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. ;-)
I have looked at several forums and read different threads, but I can't seem to find an answer. I'd really like some help. I have an array that stores Labels whose contents I display in the UITableView's row. The second row contains fresh data added to the same array and so on. My question is, everytime the labels are displayed in the UITableView, I want it to be displayed on the top row. In essence, the older ones keeps shifting one row down. I understand I need to use: "tableView:moveRowAtIndexPath:toIndexPath:" but it only seems to work with arrays whose contents are strings.
Just to clarify, I'm not displaying each element of the array on a new line. I'm displaying all the elements of the array on a single row, then changing the elements and displaying that as the next row. Except I want the second row to be above the first and so on.
The array you're using is an ordered collection of object, so the easiest way to perform what you're looking fro would be to add the new object in the first position of your array. You can achieve that using the method insertObject:atIndex: of NSMutableArray
ex:
[myArray insertObject:newObject atIndex:0];
This way you don't have to worry about moving your tableView cells ordering.
Hope this helps,
Vincent
First of all you don't need to keep the label in some array, you can keep only the string. And when add an new object to the array add it on position 0 and the do and reload of table view.
I need to create a view with images that appear depending on what items the user obtains. Basically, the view is empty, then the user obtains an item and that item appears at say, (20, 44,) then they obtain a second item and that item appears at (120, 44) and it continues on in designated positions. And I also need to add a button over each item depending on what image is placed there. I thought maybe I could use an array with each individual item having it's own x,y value, and just push items in the array according to what they get. But I am not sure how to do that. Could someone please help me? It would be infinitely appreciated.
You can add items to an NSMutableArray with addObject: (which puts the object at the end of the array) or insertObject:atIndex: (which puts the object at the designated index). That seems to be the only part of your plan you were unclear on.
Also, if the item's position can be calculated from its index in the array, there's no need to store it. You can just make a function to calculate it and call that whenever you need to draw.