rightImage working sometimes

You must Login before you can answer or comment on any questions.

I have a data table that is links to functions. After the user clicks the link and runs the function i am trying to change the right image to a checkmark to show its done. Its working .. sometimes. Other times it leaves it as the original image. Any ideas on how to fix this?

my code for the on click command is

row.addEventListener('click',function(){
    faceBarcode.text ='';
    twiterBarcode.text = '';
    yelpBarcode.text='';
    this.rightImage ='images/check.png'
    alert('scan it');
                    });
everything runs every time except for the right image. That only runs sometimes.

— asked 3 years ago by chris smashe
1 Comment
  • More info. The value is changing. If i change the alert to tell me this.rightImage instead of scan it it says images/check.png but it still has the arrow. IF i click it again sometimes it then changes.

    — commented 3 years ago by chris smashe

3 Answers

Accepted Answer

e.rowData.rightImage instead of e.source?

— answered 3 years ago by Gergely Cziva
answer permalink
1 Comment
  • So far so good. I just ran it 10 times and it repainted each time. I will run it on my phone and if it continually works there i will make the answer. Thanks everyone for your help.

    — commented 3 years ago by chris smashe

why is it this.rightImage and not e.source.rightImage like in:

row.addEventListener('click',function(e){
    faceBarcode.text ='';
    twiterBarcode.text = '';
    yelpBarcode.text='';
    e.source.rightImage ='images/check.png'
    alert('scan it');
});

— answered 3 years ago by Arturs Sosins
answer permalink
1 Comment
  • No reason. Im just used to using this from web development. I changed it to yours but I am getting the same issue. Both of ours is changing the value but its not showing the change every time. (the screen is not changing even though the value is changed)

    — commented 3 years ago by chris smashe

if its a tableview row, you can use hasCheck property, and dont need an image. maybe its better :)

— answered 3 years ago by Gergely Cziva
answer permalink
2 Comments
  • hasCheck is not seeming to do anything after runtime in an onclick event. I did a search and found this which has a resolution but it is not a public project.

    — commented 3 years ago by chris smashe

  • i have a tableview.. with rows.

    in tableview click eventlistener i have this:

    if(e.rowData.hasCheck) {
                e.rowData.hasCheck = false;         
            } else {
                e.rowData.hasCheck = true;          
            }
    and it works

    — commented 3 years ago by Gergely Cziva

Your Answer

Think you can help? Login to answer this question!