I have UITableView which has edit button in all rows with tag as id of the data in corresponding row.In the first row i have button to insert new item when i click on button on first row to add new item,navigates to insert form,add data to database in that forms n bring back to original uitableview which i reload in viewDidAppear.New Item along with button can be seen in the table n also i can view (in my logs ofcourse ) my NSMutableArray get updated with new data n button with appropriate tag (i.e with new ID) ;which i have provided as data source to uitableview; while binding data.
Now But when i tried to edit my newly added item i got correct ID for my Data at the button tag which is clicked, but surprisingly ,now , same array which i have observed being updated while binding,has short of new data in array but surprisngly visible on uitableview
y is it so ????
Have you already tried [yourTable reloadData]; ?
Related
I have a Nat table with some data in it.I want to add a new row just after the selected cell.I was able to do it. Now I have to select the newly added cell(0,new rowPosition) and edit it too. Using the selectCellCommand I was able to select the cell but the problem is with editing the cell. when I try to get the cell from Nat table using the api getCellByPoition I get null. Now this happens when I have a scrollbar and few rows are hidden at the top.Selection layer works fine and selects the first cell of the newly added row but Nat table doesn't give me the cell for the same row position.How can I get the cell to edit it? I am firing the EditCellCommand for the specified rowposition and getting the cell editor from nat table using getActiveCellEditor method.
It seems you are not aware of the position-index transformations in NatTable. I suppose you try to access your object via index. But in scrolled state the position is not equal to the index.
Please read our getting started tutorial on this topic http://www.vogella.com/tutorials/NatTable/article.html#architecture_layers
In my table I m filling the rows using an array.now the requirement of my app is
User will be able to add or delete row.
second thing is there will be a hierarchy of table view, i.e ,on click of row the same table view should be reloaded with different contents related to that row.
what actually my requirement is user would be able to create folders,rename the folder ,move the content from one folder to another,delete the content of folder,delete the folder.
here the folder is row of a table.
anyone has any idea how to do this
try inserting the below code at the index of row in the did selected method. for eg:
if(indexpath.row==0){
[self.tableView reloadData ];
}
My app has 3 tabs, and the array that populates a tableView in third tab can be changed in the other two tabs. When I switch to the third tab, I need the tableView to be updated. I know how to do this, the only problem is that the table view is a check list.
When I tick some of the rows in the third tab, switch to another tab and update the 3rd tab's array, when I want to switch back to the third tab the table is updated with the new data but the checkmarks are removed from the table.
Is there a way to update the table without removing the checkmarks?
How are you determining whether an item is checked right now? It sounds like you may not be storing the checked status of the object, and instead just setting the accessoryType on the cell to UITableViewCellAccessoryCheckmark. If so you need to add a boolean property to the objects stored in the array that will represent whether that item is currently checked or not.
Once you have this value stored you can use it when configuring your tableview cells(either in tableView: cellForRowAtIndexPath: or configureCell: atIndexPath: or wherever else you do cell configuration) to set the appropriate accessoryType for the cell.. Putting this in your cell configuration will get the tableview to correctly check items when reloading the tableview.
Are you reloading the tableview when you tap on 3rd button or creating new tableView.
If you are reloading, Use temp variable to store the data of Checkmarked cell. On every reload compare the temp data with data of cell .If it matchs place checkmark.
when you are adding objects to the array then there you can add a dictionary object, with an extra object #"FALSE",#"checkState". Initially it will FALSE for all objects, so when you are creating cells for table in your third tab check for that key in array. And when you select a cell then access the dictionary object for that indexPath.row in array and update its value to TRUE for key #"checkState".
I have a drill down tableview that is using sqlite.
The first one is a tableview where i load some categories using a SQL query.
When i click a row it's using the following query to show the appropriate records for the category:
#"SELECT * FROM table WHERE category IS ('%#')", sharedSingleton.category];
This works.
When i click the back button on tableview 2 and return to the category tableview and then touch another category tableview2 still shows the rows for the category i selected the first time.
I'm new to this stuff but i searched a long time and tried releasing objects or set value's to nil but is doesn't seem to help.
Am i in the right direction, how can i refresh or release tableview2?
Thanks in advance.
Yes you are in the right direction.
When selecting a row table 1 you might be calling a method which loads the second table view and assigning the data to be loaded to the corresponding table view,Which is fetched and filled when delegate/ data source methods of table view is called.
You might have created tableview as a different view controller class, which is initialized and data is reloaded for the first time. But even though you are fetching the second set of data its not getting reloaded automatically even after you are assigning it.
After assigning the data you have fetched into the obect which distributes it to tableview Reload the table data once you assign it to. you could call the one line of code to do this
[tableview reloadData];
Regards,
Jackson Sunny Rodrigues
I am retrieving the Json data from an URL into a table view. The problem is that i couldnt replace the old data that is retrieved, with the new data when i click another table cell. The new data is getting added to the last cell of the table cell while the old data is also getting displayed. What could be the problem...
You have to replace the data for the current cell with the new data then call the reloadData method on your tableview.
I mean you need to change the data in the array / datastore you pull from when rendering your cells in your delegate methods.
By replacing the code when the table view requests all the data & cells for rendering your delegate methods will pull the new data down and return an updated cell.