Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:34:03+00:00 2026-06-18T15:34:03+00:00

I have a tableview which contains data fetched from sqlite. I am able to

  • 0

I have a tableview which contains data fetched from sqlite. I am able to delete a record by setting editing to true.

I want to check some condition before deleting the row. If the condition is true, the row is deleted, however when the condition is false, I’m getting the following error:

no row found for index. in -[TiUITableViewProxy insertRowBefore:] (TiUITableViewProxy.m:500)

Controller

table.addEventListener('delete', function(e) {
    if(some condition){
        db.execute("DELETE FROM tbltest WHERE rowid ='" + e.source.rowid + "'");
    } else {
        alert('Deletion is not possible');
        table.insertRowBefore(e.index, e.row);
    }
}

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:34:04+00:00Added an answer on June 18, 2026 at 3:34 pm

    I have a feeling that table indexes are not refreshed. So when you’re looking up a row under the old row index, it thinks there’s nothing there.

    Try this:

    table.addEventListener('delete', function(e) {
        table.setData(table.data);
        if(some condition){
            db.execute("DELETE FROM tbltest WHERE rowid ='" + e.source.rowid + "'");
        } else {            
            alert('Deletion is not possible');
            table.insertRowBefore(e.index, e.row);
            table.setData(table.data);
        }
    }
    

    Although I’m not sure you won’t loose the e.row after you do setData.
    Another note, is that this won’t work if you’re deleting the last row. So check row’s index, compare to the rows length, and if it’s larger, just append the row. So the code becomes

    table.addEventListener('delete', function(e) {
        table.setData(table.data);
        if(some condition){
            db.execute("DELETE FROM tbltest WHERE rowid ='" + e.source.rowid + "'");
        } else {            
             // below will only work if you have 1 or no explicit sections in the table if you have more, you'll need to iterate through them
            if (e.index >= table.data[0].rows.length) {
                table.appendRow(e.row);
            } else {
                table.insertRowBefore(e.index, e.row);
            }
            table.setData(table.data);
        }
    

    I haven’t tested this, if it doesn’t work, hopefully it will at least set you on the right track 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a TableView which contains 20 rows.I have to add single labels
I have an app which contains a scrollview with several tableviews. Each tableview is
I have a tableview which contains some text and I have a label inside
i have one section table which contain the section and i want to delete
I have a tableview which contains images in cell. If I touch an image
I have UITableViewController which contains a list of items. Now, I want the list
I have a view controller MainVC which contains a view where I want to
i want to sort my Data in my Tableview. I have UIButtons with IBAction
I have a tableView which has cells with phone numbers. The app is not
I have a dynamic tableview which has a prototype cell with a button that,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.