2

I am working with jtable scroll in content. I have a code here , The issue is i want to bring the style of 'jtable tbody' to my table's tbody

script

     var oTbl;
    var newTbl;
    function scrolify(tblAsJQueryObject, height) {
        debugger;
        $('.jtable-title').remove()
        oTbl = tblAsJQueryObject;
        var oTblDiv = $("<div id='BodyDiv'/>");
        oTblDiv.css('height', height);
        oTblDiv.css('overflow', 'auto');
        oTbl.wrap(oTblDiv);
        oTbl.attr("data-item-original-width", oTbl.width());
        oTbl.find('thead tr th').each(function () {
            $(this).attr("data-item-original-width", $(this).width());
        });
        oTbl.find('tbody tr:eq(0) td').each(function () {
            $(this).attr("data-item-original-width", $(this).width());
        });
        newTbl = oTbl.clone();
        oTbl.find('thead tr').remove();
        newTbl.find('tbody tr').remove();
        oTbl.parent().parent().prepend(newTbl);    
        newTbl.width(newTbl.attr('data-item-original-width'));
        newTbl.find('thead tr td').each(function () {
            $(this).width($(this).attr("data-item-original-width"));
        });
        oTbl.width(oTbl.attr('data-item-original-width'));
        oTbl.find('tbody tr:eq(0) td').each(function () {
            $(this).width($(this).attr("data-item-original-width"));
        });
    }

    $(document).ready(function () {
        scrolify($('.jtable'), 160); 
        var td = $("#BodyDiv").find('tbody tr:eq(0) td');
        var th = $("#HeaderDiv").find('thead tr th');
        for (var i = 0; i < th.length; i++) {
            $(th[i]).resizable({ handles: "e",
                resize: function (event) {
                    for (var i = 0; i < td.length; i++) {
                        $(td[i]).width($(th[i]).width());
                    }
                }
            });
        }
    });

When the wrap() function is called the style of my table is gone, i did this by using debugger. The jtable which i selected is from jtable.org. How could i get the style of jtable to my table? what change i have to do in my code...

Krishna
  • 1,332
  • 5
  • 20
  • 35
  • When I wrap the content total style is gone. Can anyone suggest any other function similar to Wrap() – Krishna Jun 21 '14 at 09:38

0 Answers0