2 Replies Latest reply on Dec 1, 2008 9:52 AM by Nick Belaevski

    a4j:loadScript and a4j:support problem

    Hoang Nguyen Newbie

      hi,
      i want only highlight selected row in dataTable (i dont want to use scrollable dataTable or extended Datatable)
      i have read some topic. The simplest way i think that use java script file. (has someone another idea? i have tried with
      onRowClick="this.style.backgroundColor='#b3bffb'"
      but i can not reset not selected row, i want to use single select mode)

      so, my problem is that i can not load my java script file (i stored it in \WebContent\ )

      <ui:composition>
       <a4j:loadScript src="resource:///color.js"/>
       <h:form>
       <rich:dataTable value="#{dataTableBean.model}" var="model"
       binding="#{dataTableBean.table}">
      
       <a4j:support event="onRowClick" onsubmit="changeColor(this)"
       actionListener="#{dataTableBean.rowSelected}" />
      


      file color.js
      <script type="text/javascript">
      
       var oldRow;
       function changeColor(row) {
       if (oldRow != undefined) {
       oldRow.style.backgroundColor = '#ffffff';
       }
       row.style.backgroundColor = '#ebfbfb';
       oldRow = row;
       }
      </script>
      


      when i insert script direct in jsf file, it works fine. Maybe because of that i use a4j:loadScript and a4j:support at the same time? or have i forgot something?
      thanks