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 8789049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:17:42+00:00 2026-06-13T22:17:42+00:00

I’m working on Titanium and developing for iOS and I created a TableView with

  • 0

I’m working on Titanium and developing for iOS and I created a TableView with a button in every row and when you click on the row another button is added to the row, if it’s clicked again the button is removed, every control has its own behavior and its own style. The problem I’m dealing with is that when I click on the row the style on the buttons is overridden, what I mean with this is that if any of the buttons had a particular background color, said color would be overriden and replaced by the row’s backgroundColor, that also happens with the font color.

This is screenshot of how the row looks before being clicked:

enter image description here

The next one is when I click the row and the other button is added:

enter image description here

See how the small grey button background color is changed to the same color as the row background color. The same happens when I click the row to make disappear the button and click again the row to make it reappear:

enter image description here

This is how I define the row and the buttons:

function addToDo(title, priority, taskId){
    var that = {};

    var row = Ti.UI.createTableViewRow({
        height:80, 
        value : taskId,
        backgroundSelectedColor : 'transparent',
        selectedBackgroundColor : 'transparent',
        selectedColor : 'transparent',
        item_type : 'ROW'
    });

    that.currentPriority = priority;

    that.resolveColor = function(tmpPriority){
        switch(tmpPriority){

            case 0: backgroundColorPriority = "#da362a"; break;
            case 1: backgroundColorPriority = "#da6c2a"; break;
            case 2: backgroundColorPriority = "#da962a"; break;
            case 3: backgroundColorPriority = "#dacb2a"; break;             
        }
        return backgroundColorPriority;
    }

    var rowLayout = Ti.UI.createView({
        backgroundColor : 'transparent'
    });

    var checkbox = Ti.UI.createButton({
        top: 25,
        left: 5,
        width: 30,
        height: 30,
        borderColor: 'white',
        borderWidth: 2,
        borderRadius: 1,
        backgroundColor: '#b1b1b1',
        backgroundImage: 'NONE',
        item_type : 'CHECKBOX',
        value: false //value is a custom property in this case here.
    });

    row.add(checkbox);

    //Attach some simple on/off actions
    checkbox.on = function(item) {
        this.backgroundColor = '#62b425';
        item.backgroundColor = "#101010";
        this.value = true;
    };

    checkbox.off = function(item) {
        this.backgroundColor = '#b1b1b1';
        item.backgroundColor = that.resolveColor(item.currentPriority);
        this.value = false;
    };

    // Create a Label.
    var todoTitleLabel = Ti.UI.createLabel({
        text : title,
        color : 'white',
        font : {fontSize:11},
        left : 40,
        top : 35,
        textAlign : 'center'
    });

    // Add to the parent view.
    row.add(todoTitleLabel);

    // Create a Button.
    var deleteTask = Ti.UI.createButton({
        title : 'Borrar',
        height : 50,
        width : 100,
        top : 85,
        left : 110,
        item_type : 'DELETEBUTTON',
        style : Ti.UI.iPhone.SystemButtonStyle.PLAIN,
        color : '#000',
        backgroundSelectedColor : '#F7F8E0',
        selectedColor : '#F7F8E0',
        backgroundColor : '#F7F8E0'
    });

    // Add to the parent view.
    row.expand = function(){
        this.height=160;
        row.add(deleteTask);            
    };

    row.contract = function(){
        this.height=80;
        row.remove(deleteTask);

    };

    var backgroundColorPriority = that.resolveColor(that.currentPriority);      
    row.backgroundColor = backgroundColorPriority;
    that.currentRow = row;

    checkbox.container = that.currentRow;

    return that;
}

And this is how I handle the click event on the row:

table.addEventListener('click', function(e){
    if(e.source.item_type == 'CHECKBOX'){
        if(false == e.source.value) {
            e.source.on(e.source.container);
        } else {
            e.source.off(e.source.container);   
        }
    }else if(e.source.item_type == 'DELETEBUTTON'){
        alert('delete button');
    }else if(e.source.item_type == 'ROW'){
        if(!borraState){
            Ti.API.info('IN ' + JSON.stringify(e));
            taskId = e.row.value;
            todoId = tasks[taskId].todoId;
            index = e.index;
            borraLayout.animate(borrarLayoutIn);
            e.source.expand();
            borraState = true;
        }else{
            Ti.API.info('OUT ' + JSON.stringify(e));
            borraLayout.animate(borrarLayoutOut);
            borraState = false;
            e.source.contract();
        }
    }
});

I don’t understand why the colors are being overridden when the row is clicked, even though I have tried to redefine the background colors when dealing with the events, but to no avail. What am I doing wrong?

  • 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-13T22:17:44+00:00Added an answer on June 13, 2026 at 10:17 pm

    I solved this by adding the next property to my TableViewRow

    selectionStyle : Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE
    

    That property makes it so no color or effect is shown when the row is tapped/pressed/clicked/etc.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.