ERROR WEBrick::HTTPStatus::RequestURITooLarge when adding more that 10 columns

ERROR WEBrick::HTTPStatus::RequestURITooLarge when adding more that 10 columns

itsjcitsjc Posts: 8Questions: 3Answers: 0

Hello,

i am trying to add 2 more hidden columns to my datatable but i keep on receiving the URI is too large error as well as "ERROR TypeError: can't convert nil into an exact number"

These are my columns specified in my email_broadcasts_datatable.rb (the commented column are the ones that trigger the error)

def data
email_broadcasts.map do |broadcast|
[
broadcast.id,
broadcast.email_clickthroughs_count,
broadcast.email_abuse_reports_count,
# broadcast.email_unsubscribes_count,
# broadcast.email_opens_count,
broadcast.status.titleize,
broadcast.scheduled,
broadcast.subject,
broadcast.user.email,
broadcast.updated_at.in_time_zone("Eastern Time (US & Canada)").strftime('%B %-d, %Y %l:%M%P'),
link_to('', edit_email_broadcast_path(broadcast), class: "btn btn-primary fa fa-cog"),
link_to('', email_broadcast_path(broadcast), method: :delete, data: {confirm: "Are you sure you want to delete this email broadcast?"}, :remote => true, class: "btn btn-danger fa fa-trash delete_email_broadcast")
]
end
end

Also this is my javascript code for the datatable.

//Code for emails datatable

$(function() {

$('#emails').DataTable({
pageLength: 10,
responsive: true,
processing: true,
serverSide: true,
autoWidth: false,
ajax: $('#emails').data('source'),
dom: '<"html5buttons"B>lTfgitp',
buttons: [
{ extend: 'copy'},
{extend: 'csv'},
{extend: 'excel', title: 'Emails'},
{extend: 'pdf', title: 'Emails'},
{extend: 'print',
customize: function (win){
$(win.document.body).addClass('white-bg');
$(win.document.body).css('font-size', '10px');

  $(win.document.body).find('table')
  .addClass('compact')
  .css('font-size', 'inherit');
}

}
],
columnDefs: [
{
render: function ( data, type, row ) {
return data + ' ' + row[10] + ' ' + '<button type="button" class="btn btn-success" data-toggle="modal" data-target="#stats"><i class="fa fa-line-chart"></i></button>';
},
targets: 9
},
{
targets: [ 0 ], //,9,10,11
visible: false,
searchable: false
},

{
render: function ( data, type, row ) {

  switch(data) {
    case "Draft":
    return "<span class='label label-primary'>" + data + "</span>"
    case "In Queue":
    return "<span class='label label-warning'>" + data + "</span>"
    case "Completed":
    return "<span class='label label-success'>" + data + "</span>"
    case "Processing":
    return "<span class='label label-info'>" + data + "</span>"
    default:
    break;
  }
},
targets: 4

},
{
render: function ( data, type, row ) {

  if (data) {
                        //True
                        return "<span class='label label-success'>Yes</span>"
                      } else {
                        return "<span class='label label-danger'>No</span>"
                      }
                    },
                    targets: 5
                  },
                  {
                    orderable: false,
                    targets: [5,8,9]
                  }   
                  ],
                  order: [[0, 'desc' ]],
                  columns: [
                  { width: "0%" },
                  { width: "2%" },
                  { width: "2%" },
                  { width: "2%" },
                  { width: "8%" },
                  { width: "8%" },
                  { width: "30%" },
                  { width: "18%" },
                  { width: "18%" },
                  { width: "12%" }
                  ]
                });

});

And this is my table in HTML

      <table id="emails" class="table table-striped table-bordered table-hover" data-source="<%= email_broadcasts_path(format: :json) %>">
        <thead>
          <tr>
            <th>Id</th>
            <th>Click Throughs</th>
            <th>Abuse</th>
          <!--  <th>Unsuscribes</th>
           <th>Opens</th> -->
            <th>Status</th>
            <th>Scheduled</th>
            <th>Subject</th>
            <th>Created By</th>
            <th>Updated</th>
            <th>Actions</th>
          </tr>
        </thead>
        <tbody>
        </tbody>
      </table>

Thank you for your help.

Answers

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin

    Use POST rather than GET parameters in that case. This example shows how.

    Allan

This discussion has been closed.