Something wrong about "dataTables_wrapper"

Something wrong about "dataTables_wrapper"

andyyunandyyun Posts: 8Questions: 0Answers: 0
edited March 2014 in General
Hello,

when I traced my html code,I found the following code:
[code]





Showing 1 to 1 of 1 entries


Showing 1 to 3 of 3 entries


[/code]

So,there are two subTable_wrapper and two subTable_info and two subTable_paginate shows in the datatable.
How can I fix that?

Thanks a lot.

Andy

Replies

  • andyyunandyyun Posts: 8Questions: 0Answers: 0
    Check this please.thanks
    My page is just like this

    http://jsfiddle.net/2DCzp/
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You have a `dataTables_wrapper` element in your plain HTML and then you run DataTables on the table, which adds its own wrapper. Just drop the control elements in your HTML, DataTables will add them for you!

    Allan
  • andyyunandyyun Posts: 8Questions: 0Answers: 0
    that is what I got confused.because dataTables_wrapper is generated by datatable automaticely. refresh one time generate one dataTables_wrapper.

    thanks for you reply.

    Andy
  • andyyunandyyun Posts: 8Questions: 0Answers: 0
    the code is [code]
    sTable = $('#sTable').dataTable({
    "bDestroy": true,"bPaginate": false,
    "bAutoWidth": false,"bFilter": false,
    "bSort": false,"bInfo": true,
    "sAjaxSource": 'loadInstockDetails.htm?isid='+isid,
    "sAjaxDataProp": "instock.instockdetails",
    "fnServerData": function ( sSource, aoData, fnCallback ) {
    $.getJSON( sSource, aoData, function (json) {
    /* Init Instock General information */
    $("#disdate").html(json.instock.isdate);
    if(json.instock.supplier!=null) $("#dsupplier").html(json.instock.supplier.name);
    else $("#dsupplier").html("");
    $("#dpsno").html(json.instock.psno);
    $("#dquantity").html(json.instock.quantity);
    $("#ddeliverPerson").html(json.instock.deliverPerson);
    $("#dplateNo").html(json.instock.plateNo);
    $("#ddescription").html(json.instock.description);
    $("#dmemo").html(json.instock.memo);
    fnCallback(json);
    });
    },
    "aoColumns": [
    { "mData": "isdid","sWidth": "0%","bVisible": false },
    { "mData": "product.name", "sDefaultContent":"","sWidth": "25%"},
    { "mData": "quantity", "sWidth": "10%", "sClass": "alignRight" },
    { "mData": "skidNo", "sWidth": "10%" },
    { "mData": "description", "sWidth": "45%" },
    { "mData": "valuelist.propertyName","sDefaultContent":"", "sWidth": "10%" }
    ] ,
    "fnDrawCallback": function ( oSettings ) {
    $('#sTable tbody tr').each( function () {
    $(this).click(function () {
    if ( $(this).hasClass('row_selected')!=true ) {
    $(this).addClass('row_selected').siblings().removeClass('row_selected');
    }
    });
    });
    }
    });
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    No doubt I'm not getting something here, but why are putting the DataTables control elements in your static HTML? Just put the table in: http://jsfiddle.net/2DCzp/1/
This discussion has been closed.