Sha256: d4de578ab833e38afc2b6198ab4d72e0561c1fbb75b594ed34cf8d332460ca54

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

// the users table has width set to auto, but the pagination tries to stretch to full width - this
// forces the pagination to match the table
var resizePagination = function () {
  var paginationDiv = $('.dataTables_info').parents('.row').first()
  paginationDiv.width($('.dataTable').width())
}

var addDatatablesToSearchResults = function () {
  $('.add-user-search-results-table').dataTable({
    searching: false,
    order: [[ 2, "asc" ]],
    columnDefs: [ {
      targets: 3,
      orderable: false
    }]
  })
  resizePagination()
}

var addDatatablesToUsersTable = function () {
  $('.ucb-rails-users-table').dataTable({
    searching: true,
    order: [[ 3, "asc" ]],
    columnDefs: [ {
      targets: [8, 9],
      orderable: false
    }]
  })
}

$( window ).on("load", function() {
  // the datatable calling was failing intermittently, but adding the timeout
  // seemed to fix it, so ¯\_(ツ)_/¯
  window.setTimeout(addDatatablesToUsersTable, 100)

  $('.user-search-form').on('submit', function() {
    $('.ucb-rails-user-loader').show()
  })
})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ucb_rails_user-0.9.0 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js