Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9012167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:55:39+00:00 2026-06-16T02:55:39+00:00

I need to disable sorting for all the columns with no data in it.

  • 0

I need to disable sorting for all the columns with no data in it. I am looking to do it using DataTable or jQuery. If I have multiple tables, I should be able to iterate through all of them and return true or false for each column. So that I can take the result and disable column sorting. This is what I have so far, eventhough the code is incomplete.

function detectEmptyColumn(index) {

var sStatus = [], status ='';
var colors = ['red','green','blue','yellow','purple','black','cyan','green'];

$('.data-table').eq(index).find('tbody').each(function(i) {
    var self = this;
    $(self).find('tr td').each(function(j) {
        if (j > 0) {
            $(self).find('tr').each(function(k) {
                var $tableCell  = $(this).find('td:visible').eq(j);

                $tableCell.css('border','2px solid '+colors[j]);
                var $innerWrapper = $('.inner-wrapper', $tableCell);
                status = ('a', $innerWrapper).size() > 0;
                sStatus[k] = status;
                if (status) return false;
            });
        }
    });
});

return status;

}


function disableEmptyColumnSorting() {

$('.data-table').each(function(index) {
    var status = detectEmptyColumn(index);
});

}

And this is how Datatable td looks like:

<td class="reading-level interpTRC_no_interp
    firstCol
     "><div class="inner-wrapper" style="position: relative;">
        <span title="-5" class="sortindex"></span>


        <a href="/test/test123">

            &lt;PC

                <sup>F</sup>
        </a>
</div></td>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:55:40+00:00Added an answer on June 16, 2026 at 2:55 am

    Detecting an emtpy column is way easier then you do atm:

    function isColumnEmpty(index)
    {
        return $("tbody td").filter(function(){
            return $(this).index() == index && $.trim($(this).text()).length;
        }).length == 0;        
    }
    

    Above function uses the filter on the TD, then detect the index and compare it to the index of the column passed and check if the text content is larget than 0. Since all HTML tags are filtered out, you will only have the text.

    What plugin are you using so I can check out how to disable the sorting?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using TableSorter and need to disable the sorting on some columns. I can
Need to disable already selected options in select box using jQuery. I'd like it
Using xslt/xpath, I need to be able to select the two elements which have
I need to disable slickgrid horizontal scrollbar. I have only one column and have
OK, I have two HTML select elements and a button. I need to disable
i need to disable the arrow keys in a flowplayer.org scrollable i have a
I need to disable all the check boxes inside a table cell when clicking
I need to disable autocommit for oracle using erlang odbc module in Linux. I'm
I am using a WebBrowser control. I need to disable clicking or typing. How
I have an ajax controltoolkit reorderlist within an asp.net application. I need to disable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.