title: datatable fixed header for all the table
body: <p>I want to make fixed header for all the data tables used in my site.</p>
  
  <p>I got this option to add  fixed header .
  var table = $('#example').DataTable( {
          fixedHeader: true
      } );</p>
  
  <p>But how can i used it for all the table..</p>
  
  <p>I have more than 100 tables in my site...</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>function parseOptions(element) {
    element.data_options = {
      columnDefs: [],
      lengthMenu: [
        [10, 25, 50, 100, 500, 1000],
        [10, 25, 50, 100, 500, 1000]
      ],
      order: [],
      oLanguage: {
        "sProcessing": "&lt;div class='row'&gt;&lt;div class='col-sm-12 text-center'&gt;&lt;i class=\"fa fa-3x fa-spin fa-refresh text-torques\"&gt;&lt;/i&gt;&lt;h4&gt;Processing&lt;/h4&gt;&lt;/div&gt;&lt;/div&gt;",
        "sLengthMenu": "Show entries _MENU_"
      }
    };
    if (element.ifSort !== 1) {
      element.data_options["bSort"] = false;
    }
    element.column_list = [];
    element.primary_key = 0;
    if (element.serial === 1) {
      addSerial(element);
    }
    /* If Checkbox is required*/
    if (element.task === 1) {
  
      addTask(element);
    }
    /* If plus sign is required*/
    if (element.details === 1) {
  
      addDetails(element);
    }
    /*count columns*/
    element.columns = [];
    for (var i = element.primary_key; i &lt; (element.primary_key + element.default_column_count); i++) {
      element.columns.push(i);
    }
    /*count excluded columns from sorting*/
    element.excluded_columns = [];
    for (var i = 0; i &lt; element.primary_key; i++) {
      element.excluded_columns.push(i);
    }
    for (var i = 0; i &lt; element.default_column_list.length; i++) {
      var data_name = element.default_column_list[i].name.replace(".", '$');
      if (element.replaceUnderscore) {
        var data_name = element.default_column_list[i].name.replace(".", '$').replace(/\(|\)/g, "_");
      }
      var x = {
        "name": element.default_column_list[i].name.replace(".", '$'),
        "title": element.default_column_list[i].title,
        "data": data_name,
        "className": typeof element.default_column_list[i].class !== "undefined" ? element.default_column_list[i].class : ''
      };
      element.column_list.push(x);
      if (typeof element.default_column_list[i].order_by !== "undefined") {
        element.data_options['order'].push([i, element.default_column_list[i].order_by]);
      }
    }
  
    if (element.action === 1) {
      addActions(element);
    }
    var dom = '';
    if (element.column_selection &amp;&amp; element.export) {
      dom += '&lt;"row form-group"&lt;"col-sm-6"&lt;"DTTT_extras"&gt;&gt;&lt;"col-sm-6 text-right"B&gt;&gt;';
      addExport(element);
    } else if (!element.column_selection &amp;&amp; !element.export) {
      dom += '';
    } else if (element.export) {
      dom += '&lt;"row form-group"&lt;"col-sm-12"B&gt;&gt;';
      addExport(element);
    } else {
      dom += '&lt;"row form-group"&lt;"col-sm-12"&lt;"DTTT_extras"&gt;&gt;&gt;';
    }
    if (element.length_menu &amp;&amp; element.search) {
      dom += '&lt;"row"&lt;"col-sm-3" l&gt;&lt;"col-sm-4"&lt;"actions"&gt;&gt;&lt;"col-sm-5"f&gt;&gt;';
    } else if (!element.length_menu &amp;&amp; !element.search) {
      dom += '';
    } else if (element.length_menu) {
      dom += '&lt;"row"&lt;"col-sm-3" l&gt;&lt;"col-sm-9"&gt;&gt;';
    } else {
      dom += '&lt;"row"&lt;"col-sm-7"&gt;&lt;"col-sm-5"f&gt;&gt;';
    }
    dom += 'rt';
    if (element.info &amp;&amp; element.paging) {
      dom += '&lt;"row"&lt;"col-sm-6"i&gt;&lt;"col-sm-6"p&gt;&gt;';
    } else if (!element.info &amp;&amp; !element.paging) {
      dom += '';
      element.data_options['iDisplayLength'] = element.defaultLength;
    } else if (element.info) {
      dom += '&lt;"row"&lt;"col-sm-12"i&gt;&gt;';
      element.data_options['iDisplayLength'] = element.defaultLength;
    } else {
      dom += '&lt;"row"&lt;"col-sm-6"p&gt;&gt;';
    }
    element.data_options['dom'] = dom;
    if (element.realtime) {
      if (element.ifRealtimeExtraProperty === 1) {
        element.data_options['ajax'] = {
          "url": element.url,
          "data": function(d) {
            if (typeof element.realtimeExtraProperty.key === "undefined") {
              $.each(element.realtimeExtraProperty, function(k, v) {
                d[v.key] = v.value;
              });
            } else {
              d[element.realtimeExtraProperty.key] = element.realtimeExtraProperty.value;
            }
            if (typeof window[element.realtimeCallback] === 'function') {
              window[element.realtimeCallback](d);
            }
          },
        };
      } else {
        element.data_options['ajax'] = {
          "url": element.url
        };
      }
      element.data_options['ajax']["dataSrc"] = function(json) {
        //                            for (var i = 0, ien = json.length; i &lt; ien; i++) {
        //                                json[i][0] = '&lt;a href="/message/' + json[i][0] + '&gt;View message&lt;/a&gt;';
        //                            }
        var returnVal = null;
        if (typeof json.data === "object") {
          if (json.success !== true) {
            switch (json.data.action) {
              case "login":
                if ($("#system-modal").length &gt; 0) {
                  $("#system-modal .modal-dialog").html(json.customData);
                  $('#status-messages').html(json.screen_message);
                  $("#system-modal").modal({
                    backdrop: 'static',
                    keyboard: false,
                    show: true
                  });
                  initCheckboxRadio();
                  setScrMsgTimeOut();
                } else {
                  window.location.href = json.data.url;
                }
                returnVal = [];
                break;
              default:
                returnVal = json.data;
            }
          }
        } else {
          if (typeof json.screen_message === "string") {
            $('#status-messages').html(json.screen_message);
            setScrMsgTimeOut();
          }
          returnVal = json.data;
        }
        if (typeof window[element.getDataCallback] === 'function') {
          returnVal = window[element.getDataCallback](returnVal);
        }
        return returnVal;
      };
      element.data_options['serverSide'] = true;
      element.data_options['processing'] = true;
    }
    element.data_options['stateSave'] = true;
    element.data_options['stateDuration'] = -1;
    if (element.data_options['order'].length &lt;= 0) {
      element.data_options['order'].push([element.primary_key, element.order]);
    }
    element.data_options['columns'] = element.column_list;
    element.data_options['columnDefs'].push({
      "orderable": false,
      "searchable": false,
      data: null,
      targets: element.excluded_columns
    });
    element.data_options['drawCallback'] = function(settings) {
      if (element.task === 1) {
        $('.row-selected').checkboxradio();
      }
      if (element.details === 1) {
        $.each(window[element.id + '_details'], function(i, d) {
          $('#' + element.id + ' .show-details[data-id="' + d + '"]').trigger('click');
        });
      }
      var api = this.api();
      if (element.onDrawCallback &amp;&amp; typeof element.onDrawCallback !== 'undefined') {
        try {
          window[element.onDrawCallback](api);
        } catch (err) {
          console.log(element.onDrawCallback + " is not accessible. Stack Trace" + err);
        }
      }
    };
    //
    console.log(element.data_options);
  
    window[element.id] = $('#' + element.id).DataTable(element.data_options); //fixed header true option
    addSelectPicker(element);
  }
  </code></pre>
  
  <p>How can I add here .</p>
  
  <p><code>window[element.id] = $('#' + element.id).DataTable(element.data_options)</code></p>
  
  <p>Can anyone suggest me ,how can i do this ?</p>