No Data Available If orderable:false

No Data Available If orderable:false

wajeehwajeeh Posts: 1Questions: 0Answers: 0
edited April 2020 in Free community support

There are six columns in my table like this

def data
    brands.map do |brand|
      [].tap do |column|
        column << brand.franchise.name
        column << brand.name
        column << brand.segment
        column << manage_businesses(brand)
        column << 'Hospitality'
        links = []
         if brand.deleted_at? 
          links << link_to('Restore', soft_restore_franchises_path(id: brand.id), method: :get, data: { confirm: 'Are you sure you want to Restore this?' }, class: 'request_action_btn cancel_btn', title: 'Restore')
         else
          links << link_to('Edit', "franchise/edit/#{brand.franchise_id}", :remote => true, class: 'request_action_btn')
          links << link_to('Delete', "franchise/softdelete/#{brand.franchise_id}" , class: 'request_action_btn', method: :get,class: 'request_action_btn cancel_btn')
        end
        column << links.join('')
      end
    end
  end

And I'm Using this code to disable the sorting of last column

$('#business_table').dataTable({
  "columnDefs": [
      {"targets": [5], "orderable": false},
    ]
});

Although it disables the sorting but there is no data available in table while its there in DB

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    I don't understand. Are you saying adding columns.orderable stops data from loading? That would be odd if that's the case.

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.