When I remove and then, add a row on tableview, it adds the removed row
up vote
-1
down vote
favorite
I am trying to let the user edit a tableview, which is adding and removing rows.
That works. But if I remove a row and then add, the inserted row has the info of the deleted row. Is literally the deleted row.
What I am doing wrong?
@IBAction func addArticle(_ sender: UIButton) {
numItems += 1
let indexPath = IndexPath(row: numItems - 1, section: 0)
myTableView.beginUpdates()
myTableView.insertRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
view.endEditing(true)
}
@objc func removeArticle(sender: UIButton) {
numItems -= 1
let indexPath = IndexPath(row: sender.tag, section: 0)
myTableView.beginUpdates()
myTableView.deleteRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
}
The datasource and delegate for the tableview as follows:
extension MyViewController: UITableViewDataSource, UITableViewDelegate{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return numItems
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
numItems -= 1
self.myTableView.beginUpdates()
self.myTableView.deleteRows(at: [indexPath], with: .automatic)
self.myTableView.endUpdates()
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if firstUse{
firstUse = false
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MyTableViewCell
if firstUse{
//setting cell
//...
cell.name.isEnabled = false
cell.name.textColor = UIColor.gray
cell.unit.text = //something
}
return initCell(cell: cell, indexPath: indexPath)
}
func initCell(cell: MyTableViewCell, indexPath: IndexPath) -> MyTableViewCell {
cell.name.inputAccessoryView = addDoneToolbarKeyboard()
cell.amount.inputAccessoryView = addDoneToolbarKeyboard()
cell.name.filterStrings(getFilteredBy())
cell.minusButton.tag = indexPath.row
cell.minusButton.addTarget(self, action: #selector(self.removeArticle), for: .touchUpInside)
cell.name.itemSelectionHandler = { filteredResults, itemPosition in
//irrelevant code
}
}
return cell
}
}
Thank you in advance.
ios swift uitableview
|
show 1 more comment
up vote
-1
down vote
favorite
I am trying to let the user edit a tableview, which is adding and removing rows.
That works. But if I remove a row and then add, the inserted row has the info of the deleted row. Is literally the deleted row.
What I am doing wrong?
@IBAction func addArticle(_ sender: UIButton) {
numItems += 1
let indexPath = IndexPath(row: numItems - 1, section: 0)
myTableView.beginUpdates()
myTableView.insertRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
view.endEditing(true)
}
@objc func removeArticle(sender: UIButton) {
numItems -= 1
let indexPath = IndexPath(row: sender.tag, section: 0)
myTableView.beginUpdates()
myTableView.deleteRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
}
The datasource and delegate for the tableview as follows:
extension MyViewController: UITableViewDataSource, UITableViewDelegate{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return numItems
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
numItems -= 1
self.myTableView.beginUpdates()
self.myTableView.deleteRows(at: [indexPath], with: .automatic)
self.myTableView.endUpdates()
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if firstUse{
firstUse = false
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MyTableViewCell
if firstUse{
//setting cell
//...
cell.name.isEnabled = false
cell.name.textColor = UIColor.gray
cell.unit.text = //something
}
return initCell(cell: cell, indexPath: indexPath)
}
func initCell(cell: MyTableViewCell, indexPath: IndexPath) -> MyTableViewCell {
cell.name.inputAccessoryView = addDoneToolbarKeyboard()
cell.amount.inputAccessoryView = addDoneToolbarKeyboard()
cell.name.filterStrings(getFilteredBy())
cell.minusButton.tag = indexPath.row
cell.minusButton.addTarget(self, action: #selector(self.removeArticle), for: .touchUpInside)
cell.name.itemSelectionHandler = { filteredResults, itemPosition in
//irrelevant code
}
}
return cell
}
}
Thank you in advance.
ios swift uitableview
The documentation on insertRows (developer.apple.com/documentation/uikit/uitableview/…) says this method calls the relevant datasource and delegate methods. Can you add your datasource delegate information? Do you use cellForRow (developer.apple.com/documentation/uikit/uitableview/…)?
– Jason
Nov 19 at 20:10
Updated info. Is that the one you are taking about?
– Amg91
Nov 19 at 20:29
As always,beginUpdates()andendUpdates()is syntactic sugar in this case. It has no effect at all.
– vadian
Nov 19 at 20:38
Not sure what you meant. But it adds and removes rows. On all the places where I have searched, they use begin and end. Is not this correct?
– Amg91
Nov 19 at 20:40
No, it's not correct (although it causes no harm) . There are many tutorials which suggest this nonsense. Both methods are required if multipleinsert/delete/moveoperations are performed simultaneously, only there. In your case it's pointless.
– vadian
Nov 19 at 20:45
|
show 1 more comment
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am trying to let the user edit a tableview, which is adding and removing rows.
That works. But if I remove a row and then add, the inserted row has the info of the deleted row. Is literally the deleted row.
What I am doing wrong?
@IBAction func addArticle(_ sender: UIButton) {
numItems += 1
let indexPath = IndexPath(row: numItems - 1, section: 0)
myTableView.beginUpdates()
myTableView.insertRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
view.endEditing(true)
}
@objc func removeArticle(sender: UIButton) {
numItems -= 1
let indexPath = IndexPath(row: sender.tag, section: 0)
myTableView.beginUpdates()
myTableView.deleteRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
}
The datasource and delegate for the tableview as follows:
extension MyViewController: UITableViewDataSource, UITableViewDelegate{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return numItems
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
numItems -= 1
self.myTableView.beginUpdates()
self.myTableView.deleteRows(at: [indexPath], with: .automatic)
self.myTableView.endUpdates()
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if firstUse{
firstUse = false
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MyTableViewCell
if firstUse{
//setting cell
//...
cell.name.isEnabled = false
cell.name.textColor = UIColor.gray
cell.unit.text = //something
}
return initCell(cell: cell, indexPath: indexPath)
}
func initCell(cell: MyTableViewCell, indexPath: IndexPath) -> MyTableViewCell {
cell.name.inputAccessoryView = addDoneToolbarKeyboard()
cell.amount.inputAccessoryView = addDoneToolbarKeyboard()
cell.name.filterStrings(getFilteredBy())
cell.minusButton.tag = indexPath.row
cell.minusButton.addTarget(self, action: #selector(self.removeArticle), for: .touchUpInside)
cell.name.itemSelectionHandler = { filteredResults, itemPosition in
//irrelevant code
}
}
return cell
}
}
Thank you in advance.
ios swift uitableview
I am trying to let the user edit a tableview, which is adding and removing rows.
That works. But if I remove a row and then add, the inserted row has the info of the deleted row. Is literally the deleted row.
What I am doing wrong?
@IBAction func addArticle(_ sender: UIButton) {
numItems += 1
let indexPath = IndexPath(row: numItems - 1, section: 0)
myTableView.beginUpdates()
myTableView.insertRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
view.endEditing(true)
}
@objc func removeArticle(sender: UIButton) {
numItems -= 1
let indexPath = IndexPath(row: sender.tag, section: 0)
myTableView.beginUpdates()
myTableView.deleteRows(at: [indexPath], with: .automatic)
myTableView.endUpdates()
}
The datasource and delegate for the tableview as follows:
extension MyViewController: UITableViewDataSource, UITableViewDelegate{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return numItems
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
numItems -= 1
self.myTableView.beginUpdates()
self.myTableView.deleteRows(at: [indexPath], with: .automatic)
self.myTableView.endUpdates()
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if firstUse{
firstUse = false
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MyTableViewCell
if firstUse{
//setting cell
//...
cell.name.isEnabled = false
cell.name.textColor = UIColor.gray
cell.unit.text = //something
}
return initCell(cell: cell, indexPath: indexPath)
}
func initCell(cell: MyTableViewCell, indexPath: IndexPath) -> MyTableViewCell {
cell.name.inputAccessoryView = addDoneToolbarKeyboard()
cell.amount.inputAccessoryView = addDoneToolbarKeyboard()
cell.name.filterStrings(getFilteredBy())
cell.minusButton.tag = indexPath.row
cell.minusButton.addTarget(self, action: #selector(self.removeArticle), for: .touchUpInside)
cell.name.itemSelectionHandler = { filteredResults, itemPosition in
//irrelevant code
}
}
return cell
}
}
Thank you in advance.
ios swift uitableview
ios swift uitableview
edited Nov 19 at 20:59
asked Nov 19 at 19:58
Amg91
99115
99115
The documentation on insertRows (developer.apple.com/documentation/uikit/uitableview/…) says this method calls the relevant datasource and delegate methods. Can you add your datasource delegate information? Do you use cellForRow (developer.apple.com/documentation/uikit/uitableview/…)?
– Jason
Nov 19 at 20:10
Updated info. Is that the one you are taking about?
– Amg91
Nov 19 at 20:29
As always,beginUpdates()andendUpdates()is syntactic sugar in this case. It has no effect at all.
– vadian
Nov 19 at 20:38
Not sure what you meant. But it adds and removes rows. On all the places where I have searched, they use begin and end. Is not this correct?
– Amg91
Nov 19 at 20:40
No, it's not correct (although it causes no harm) . There are many tutorials which suggest this nonsense. Both methods are required if multipleinsert/delete/moveoperations are performed simultaneously, only there. In your case it's pointless.
– vadian
Nov 19 at 20:45
|
show 1 more comment
The documentation on insertRows (developer.apple.com/documentation/uikit/uitableview/…) says this method calls the relevant datasource and delegate methods. Can you add your datasource delegate information? Do you use cellForRow (developer.apple.com/documentation/uikit/uitableview/…)?
– Jason
Nov 19 at 20:10
Updated info. Is that the one you are taking about?
– Amg91
Nov 19 at 20:29
As always,beginUpdates()andendUpdates()is syntactic sugar in this case. It has no effect at all.
– vadian
Nov 19 at 20:38
Not sure what you meant. But it adds and removes rows. On all the places where I have searched, they use begin and end. Is not this correct?
– Amg91
Nov 19 at 20:40
No, it's not correct (although it causes no harm) . There are many tutorials which suggest this nonsense. Both methods are required if multipleinsert/delete/moveoperations are performed simultaneously, only there. In your case it's pointless.
– vadian
Nov 19 at 20:45
The documentation on insertRows (developer.apple.com/documentation/uikit/uitableview/…) says this method calls the relevant datasource and delegate methods. Can you add your datasource delegate information? Do you use cellForRow (developer.apple.com/documentation/uikit/uitableview/…)?
– Jason
Nov 19 at 20:10
The documentation on insertRows (developer.apple.com/documentation/uikit/uitableview/…) says this method calls the relevant datasource and delegate methods. Can you add your datasource delegate information? Do you use cellForRow (developer.apple.com/documentation/uikit/uitableview/…)?
– Jason
Nov 19 at 20:10
Updated info. Is that the one you are taking about?
– Amg91
Nov 19 at 20:29
Updated info. Is that the one you are taking about?
– Amg91
Nov 19 at 20:29
As always,
beginUpdates() and endUpdates() is syntactic sugar in this case. It has no effect at all.– vadian
Nov 19 at 20:38
As always,
beginUpdates() and endUpdates() is syntactic sugar in this case. It has no effect at all.– vadian
Nov 19 at 20:38
Not sure what you meant. But it adds and removes rows. On all the places where I have searched, they use begin and end. Is not this correct?
– Amg91
Nov 19 at 20:40
Not sure what you meant. But it adds and removes rows. On all the places where I have searched, they use begin and end. Is not this correct?
– Amg91
Nov 19 at 20:40
No, it's not correct (although it causes no harm) . There are many tutorials which suggest this nonsense. Both methods are required if multiple
insert/delete/move operations are performed simultaneously, only there. In your case it's pointless.– vadian
Nov 19 at 20:45
No, it's not correct (although it causes no harm) . There are many tutorials which suggest this nonsense. Both methods are required if multiple
insert/delete/move operations are performed simultaneously, only there. In your case it's pointless.– vadian
Nov 19 at 20:45
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
0
down vote
I'm not seeing a use of indexPath in your initCell method (other than setting cell.minusButton.tag). Typically you use the indexPath as an index to an array of data, or something similar along those lines. I would be able to tell for sure if I could see where your table gets its data, but judging from that and the way you call names = Array() and amounts = Array(), I'm guessing that you are not updating your data model when you add something to the table. The table dequeues the cell and gets the deleted data. Since the data model feeding the cell is not updated, it creates the same cell and displays it
The thing is, the user adds rows on the tableview that contains textFields to input text (that is why I am not filling the tableview with info, because the user inputs it). After a few types, the user can select from the filtered array. After that, the textfield is disabled.
– Amg91
Nov 19 at 20:53
So, can I add a brand new row?
– Amg91
Nov 19 at 20:54
I removed thenamesandamounsdue to no longer used...
– Amg91
Nov 19 at 21:00
Ok, I'm following along. Now where are you storing information regarding user input (i.e. the user's array selection or the value in the text field)?
– Jason
Nov 19 at 21:48
Each time the user input text and select it from the filtered data, I get certain info. After user click save, i send it to the server.
– Amg91
Nov 19 at 21:52
|
show 7 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I'm not seeing a use of indexPath in your initCell method (other than setting cell.minusButton.tag). Typically you use the indexPath as an index to an array of data, or something similar along those lines. I would be able to tell for sure if I could see where your table gets its data, but judging from that and the way you call names = Array() and amounts = Array(), I'm guessing that you are not updating your data model when you add something to the table. The table dequeues the cell and gets the deleted data. Since the data model feeding the cell is not updated, it creates the same cell and displays it
The thing is, the user adds rows on the tableview that contains textFields to input text (that is why I am not filling the tableview with info, because the user inputs it). After a few types, the user can select from the filtered array. After that, the textfield is disabled.
– Amg91
Nov 19 at 20:53
So, can I add a brand new row?
– Amg91
Nov 19 at 20:54
I removed thenamesandamounsdue to no longer used...
– Amg91
Nov 19 at 21:00
Ok, I'm following along. Now where are you storing information regarding user input (i.e. the user's array selection or the value in the text field)?
– Jason
Nov 19 at 21:48
Each time the user input text and select it from the filtered data, I get certain info. After user click save, i send it to the server.
– Amg91
Nov 19 at 21:52
|
show 7 more comments
up vote
0
down vote
I'm not seeing a use of indexPath in your initCell method (other than setting cell.minusButton.tag). Typically you use the indexPath as an index to an array of data, or something similar along those lines. I would be able to tell for sure if I could see where your table gets its data, but judging from that and the way you call names = Array() and amounts = Array(), I'm guessing that you are not updating your data model when you add something to the table. The table dequeues the cell and gets the deleted data. Since the data model feeding the cell is not updated, it creates the same cell and displays it
The thing is, the user adds rows on the tableview that contains textFields to input text (that is why I am not filling the tableview with info, because the user inputs it). After a few types, the user can select from the filtered array. After that, the textfield is disabled.
– Amg91
Nov 19 at 20:53
So, can I add a brand new row?
– Amg91
Nov 19 at 20:54
I removed thenamesandamounsdue to no longer used...
– Amg91
Nov 19 at 21:00
Ok, I'm following along. Now where are you storing information regarding user input (i.e. the user's array selection or the value in the text field)?
– Jason
Nov 19 at 21:48
Each time the user input text and select it from the filtered data, I get certain info. After user click save, i send it to the server.
– Amg91
Nov 19 at 21:52
|
show 7 more comments
up vote
0
down vote
up vote
0
down vote
I'm not seeing a use of indexPath in your initCell method (other than setting cell.minusButton.tag). Typically you use the indexPath as an index to an array of data, or something similar along those lines. I would be able to tell for sure if I could see where your table gets its data, but judging from that and the way you call names = Array() and amounts = Array(), I'm guessing that you are not updating your data model when you add something to the table. The table dequeues the cell and gets the deleted data. Since the data model feeding the cell is not updated, it creates the same cell and displays it
I'm not seeing a use of indexPath in your initCell method (other than setting cell.minusButton.tag). Typically you use the indexPath as an index to an array of data, or something similar along those lines. I would be able to tell for sure if I could see where your table gets its data, but judging from that and the way you call names = Array() and amounts = Array(), I'm guessing that you are not updating your data model when you add something to the table. The table dequeues the cell and gets the deleted data. Since the data model feeding the cell is not updated, it creates the same cell and displays it
answered Nov 19 at 20:42
Jason
469315
469315
The thing is, the user adds rows on the tableview that contains textFields to input text (that is why I am not filling the tableview with info, because the user inputs it). After a few types, the user can select from the filtered array. After that, the textfield is disabled.
– Amg91
Nov 19 at 20:53
So, can I add a brand new row?
– Amg91
Nov 19 at 20:54
I removed thenamesandamounsdue to no longer used...
– Amg91
Nov 19 at 21:00
Ok, I'm following along. Now where are you storing information regarding user input (i.e. the user's array selection or the value in the text field)?
– Jason
Nov 19 at 21:48
Each time the user input text and select it from the filtered data, I get certain info. After user click save, i send it to the server.
– Amg91
Nov 19 at 21:52
|
show 7 more comments
The thing is, the user adds rows on the tableview that contains textFields to input text (that is why I am not filling the tableview with info, because the user inputs it). After a few types, the user can select from the filtered array. After that, the textfield is disabled.
– Amg91
Nov 19 at 20:53
So, can I add a brand new row?
– Amg91
Nov 19 at 20:54
I removed thenamesandamounsdue to no longer used...
– Amg91
Nov 19 at 21:00
Ok, I'm following along. Now where are you storing information regarding user input (i.e. the user's array selection or the value in the text field)?
– Jason
Nov 19 at 21:48
Each time the user input text and select it from the filtered data, I get certain info. After user click save, i send it to the server.
– Amg91
Nov 19 at 21:52
The thing is, the user adds rows on the tableview that contains textFields to input text (that is why I am not filling the tableview with info, because the user inputs it). After a few types, the user can select from the filtered array. After that, the textfield is disabled.
– Amg91
Nov 19 at 20:53
The thing is, the user adds rows on the tableview that contains textFields to input text (that is why I am not filling the tableview with info, because the user inputs it). After a few types, the user can select from the filtered array. After that, the textfield is disabled.
– Amg91
Nov 19 at 20:53
So, can I add a brand new row?
– Amg91
Nov 19 at 20:54
So, can I add a brand new row?
– Amg91
Nov 19 at 20:54
I removed the
names and amouns due to no longer used...– Amg91
Nov 19 at 21:00
I removed the
names and amouns due to no longer used...– Amg91
Nov 19 at 21:00
Ok, I'm following along. Now where are you storing information regarding user input (i.e. the user's array selection or the value in the text field)?
– Jason
Nov 19 at 21:48
Ok, I'm following along. Now where are you storing information regarding user input (i.e. the user's array selection or the value in the text field)?
– Jason
Nov 19 at 21:48
Each time the user input text and select it from the filtered data, I get certain info. After user click save, i send it to the server.
– Amg91
Nov 19 at 21:52
Each time the user input text and select it from the filtered data, I get certain info. After user click save, i send it to the server.
– Amg91
Nov 19 at 21:52
|
show 7 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381776%2fwhen-i-remove-and-then-add-a-row-on-tableview-it-adds-the-removed-row%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The documentation on insertRows (developer.apple.com/documentation/uikit/uitableview/…) says this method calls the relevant datasource and delegate methods. Can you add your datasource delegate information? Do you use cellForRow (developer.apple.com/documentation/uikit/uitableview/…)?
– Jason
Nov 19 at 20:10
Updated info. Is that the one you are taking about?
– Amg91
Nov 19 at 20:29
As always,
beginUpdates()andendUpdates()is syntactic sugar in this case. It has no effect at all.– vadian
Nov 19 at 20:38
Not sure what you meant. But it adds and removes rows. On all the places where I have searched, they use begin and end. Is not this correct?
– Amg91
Nov 19 at 20:40
No, it's not correct (although it causes no harm) . There are many tutorials which suggest this nonsense. Both methods are required if multiple
insert/delete/moveoperations are performed simultaneously, only there. In your case it's pointless.– vadian
Nov 19 at 20:45