alfajango / jquery-dynatable

A more-fun, semantic, alternative to datatables
http://www.dynatable.com
Other
2.77k stars 363 forks source link

Understand the use of bind method and functions in a dynatable #248

Closed hammerva closed 8 years ago

hammerva commented 8 years ago

Hello. I am pretty new to Javascript trying to work on this application for my job. The page contains a dynatable with pagination. I added a 'click' function in my JSP file that does disables some fields when the user clicks to a new page.

$(document).on('click', '.dynatable-page-link', function() 
      {
              var statusCheck = $('#UpdCMDStatus').val();
             alert ("Enter the function on dynatable page link")  ;

              if (statusCheck === "CP" || statusCheck === "VP")
             {
                $('table#checkedTable input[type=checkbox]').attr("disabled", true);
                $('table#checkedTable input[type=text]').attr("disabled", true)
                $('table#checkedTable select[id^=Modify]').attr("disabled", true);
             }  
             else
             {
                $('table#checkedTable input[type=checkbox]').removeAttr("disabled");
             }
          });  

The function is working fine but the processing is occurring before the call of our dynatable.js file (at least it seems) and it wipes out everything. I am trying to figure out where to put this so that it occurs after dynatable processing. I was thinking I can include something in the 'dynatable:afterProcess' event and I saw something involving a .bind statement. But I am confused about how to use it

  1. Is bind method something that appends a task/function to an event or replaces it?
  2. Does the bind statement tied to a function have to be included in the dynatable.js file or can it be included in a JSP file after the dynatable() call?

Thanks