1

I am trying colResizable.min.js to make html table column resizable. In my jsp page I have included colResizable.min.js file as below.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
<link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/lib/bootstrap-responsive.min.css"
rel="stylesheet">
<link href="css/report.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">  </script>
<script
src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"> </script>
<script src="http://mrrio.github.io/jsPDF/dist/jspdf.debug.js"></script>
<script src="assets/js/lib/colResizable.min.js"></script>

Then I use this.

$("#table-0").colResizable();

I am getting following errors in my console log.

colResizable.min.js:2 Uncaught TypeError: Cannot read property 'msie' of undefined colResizable.min.js:2 Uncaught TypeError: $(...).colResizable is not a function

My full code.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
<link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/lib/bootstrap-responsive.min.css"
rel="stylesheet">
<link href="css/report.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">  </script>
<script
src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"> </script>
<script src="assets/js/lib/jquery-migrate-1.2.1.js"></script>
<script src="assets/js/lib/jspdf.debug.js"></script>
<script src="assets/js/lib/colResizable.min.js"></script>
<script src="assets/js/export.js"></script>
<script src="assets/js/saveButtonHandler.js"></script>
<script type="text/javascript">
$(window)
        .load(
                function() {
                    var myList;

                    if ($('#table-0').length) {

                        var $row = $('#table-0 tr:first');
                        $row.remove();
                    } else {
                        $('#design').append(
                                "<table id='table-0' border=1></table>");
                    }

                    $
                            .getJSON(
                                    "/ReportBuilder/data.json",
                                    function(data) {
                                        console.log("11122333");
                                        console.log(data);
                                        myList = data;

                                        if (myList.length == 0) {
                                            alert("Your Report Has No Data");
                                        } else {
                                            var columns = [];
                                            var headerTr$ = $('<tr/>');

                                            for (var i = 0; i < myList.length; i++) {
                                                var rowHash = myList[i];
                                                for ( var key in rowHash) {
                                                    if ($.inArray(key,
                                                            columns) == -1) {
                                                        columns.push(key);
                                                        headerTr$.append($(
                                                                '<th/>')
                                                                .html(key));
                                                    }
                                                }
                                            }
                                            $("#table-0").append(headerTr$);

                                            for (var i = 0; i < myList.length; i++) {
                                                var row$ = $('<tr/>');
                                                for (var colIndex = 0; colIndex < columns.length; colIndex++) {
                                                    var cellValue = myList[i][columns[colIndex]];

                                                    if (cellValue == null) {
                                                        cellValue = "";
                                                    }

                                                    row$
                                                            .append($(
                                                                    '<td/>')
                                                                    .html(
                                                                            cellValue));
                                                }
                                                $("#table-0").append(row$);
                                            }
                                        }

                                    });
                    $(document).on("dblclick", "#table-0 th", function() {
                        $(this).prop('contenteditable', true);
                    });

                    $(document).on("dblclick", "#subtitle-0", function() {
                        $(this).prop('contenteditable', true);

                    });

                    $(document).on("dblclick", "#title-0", function() {
                        $(this).prop('contenteditable', true);
                    });

                    $("table").colResizable();
                    //makeResizable();

                });
</script>
</head>

Whats wrong with my code ? Any suggestions are appreciated.

Thank You

3
  • Did you check that your script is loading? Commented Nov 16, 2015 at 5:58
  • 1
    jQuery.browser() removed Commented Nov 16, 2015 at 6:30
  • @Drixson, yes, my script is loading Commented Nov 16, 2015 at 6:38

1 Answer 1

1

you are using new jquery and jQuery.browser() removed in new version.so it will give you error.

see this link http://jquery.com/upgrade-guide/1.9/#jquery-browser-removed

use http://code.jquery.com/jquery-migrate-1.2.1.js it will solve your problem.

Sign up to request clarification or add additional context in comments.

3 Comments

Then how can I make table columns resizable in new jquery version ?
i tried code.jquery.com/jquery-migrate-1.2.1.js. Now there is no any error in console. But still my table cannot be resizable :(
call $("table").colResizable(); after table creation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.