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

  • SEARCH
  • Home
  • 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 7703157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:23:38+00:00 2026-05-31T23:23:38+00:00

I have a simple HTML table which is bound using knockoutJS. However, I’ve added

  • 0

I have a simple HTML table which is bound using knockoutJS. However, I’ve added a custom binding which applies the jquery datatable plugin on the table.

When I click the headers, the table disappears. Any idea how I can get it working with knockoutJS?

  • 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-05-31T23:23:39+00:00Added an answer on May 31, 2026 at 11:23 pm

    Its actually unnecessary to use knockoutJs to carry out the binding of the dataTable. As knockoutJs already binds the HTML table to the model, just use the following:

    $(function() {
            var dtOptions = {
                    "bPaginate": false,
                    "bLengthChange": false,
                    "bFilter": false,
                    "bInfo": false,
                    bJQueryUI: true              
            }
    
            var dt = $("#leadsTable").dataTable(dtOptions);
    
            $("#searchButton").click(function() {
               //... set url with search terms...
    
               $.get(url, function (data) {
                    // destroy existing table
                    dt.fnDestroy();
    
                    ko.mapping.fromJS(data, vm.model);
    
                    // re-created AFTER ko mapping
                    dt.dataTable(dtOptions);                    
               });
           })
    });
    
    var serialisedModel = @Html.Raw(new JavaScriptSerializer().Serialize(Model));
    
    var vm = {      
        data: ko.toJSON(serialisedModel),
    }
    
    ko.applyBindings(vm);
    

    The crucial part is to destroy the existing dataTable before the mapping, and re-create after mapping. I had to keep a reference to the initial dataTable for later destroying…

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

Sidebar

Related Questions

I have a very simple HTML table, to which jQuery sortable is applied so
I have a simple HTML input file; which contains a table. The column headers
I have a simple html table which has several rows. the following is implemented
I have a simple HTML Table (10 columns x 500 rows). When the page
I'm trying to have a simple html table, that highlights a row as a
I have a simple HTML form which consists of radio buttons where user has
Im working on a simple html/javascript multiplication game, in which I have a multiplication
I have a simple table which has a some information displayed. To view the
I have a simple option tag in html which lists all users held on
I have a simple php page which outputs a table (which has been created

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.