How to Pass inputText values From datatable

How to Pass inputText values From datatable

ashrafshaidaashrafshaida Posts: 1Questions: 0Answers: 0
edited August 2013 in General
Hi Friends,
I am facing a problem using JSF datatable . I have a datatable inside datatable there is inputtext box. I want to do font color. It's working like this onkeyup="this.style.color=(this.value<40)?'red':'green' This javascript is implemented in every inpute text box
It's cheking condition less than 40 it will be red color or else green color But when page is getting refereshed this condition is failed. means it's only displaying one color. So kindly any body know this how to resolve this issue... even page referesh . i will be thanks to him It's urgent so please help

Thanks in Advance

Replies

  • aaronwaaronw Posts: 89Questions: 3Answers: 4
    So, the problem is that you're using onkeyup - which as you pointed out, acts when the key goes up. But that's not really what you want to do. Instead, look into http://api.jquery.com/on/ for your functionality. Also, how is a page getting refreshed? Is this with a reload of the page, or via some other mechanism? You might want to look into http://www.datatables.net/usage/callbacks#fnRowCallback which is a function that gets called whenever a row gets drawn. You can modify the HTML at that point. So you really have 2 things you want to do - 1) update the color dynamically on a key up and 2) have the color be 'accurate' at all times. These are a little bit different, so they require different methods to get to your goal.
This discussion has been closed.