3 Replies Latest reply on Jan 4, 2008 8:46 AM by Ilya Shaikovsky

    selectedRow (dataTable or orderingList)

    Mo Pour Newbie

      Hi,
      I have looked at many ways to change the background color of my selected dataTable row.
      I used javascript, but whenever the page refreshes I loose the selected row color.

      I ended up changing the rowClasses attribute on the server side, but I'm having to reRender my table everytime I click on a row, which is not ideal.

      I also looked at mixing JavaScript and rowClasses, but the javascript that would reset previous row colours does not work under IE, it sees .rows attribute is undifiend.

       function changeRowColor(row){
       var table = document.getElementById('searchForm:searchTable');
       if(table!=null){
       for(var n = 0; n < table.rows.length; n++) {
       var _row = table.rows[n];
       _row.style.background='#{a4jSkin.tableBackgroundColor}';
       }
       }
       row.style.background='#f9e089';
       }
      


      I have also used scrollableDataTable, but I was not happy with its performance.

      I wanted to know how you have managed to achive the row selection in the new orderingList component.

      regards
      Mo