select row

select row

susersuser Posts: 68Questions: 18Answers: 0
edited October 2016 in Free community support

i try to select row from table but this show errors

` <script type="text/javascript">
        $(function () {
       
            var table = $('#master_table').DataTable();
                debugger;
            $("#master_table tbody").on('click', 'tr', function () {
                if ($(this).hasClass('selected')) {
                    $(this).removeClass('selected');
                }
                else {
                    table.$('tr', 'selected').removeClass('selected');
                    $(this).addClass('selected');
                }
            });
        
           
            $('[ID*=btnadd]').on('click', function () {

                var ID = '<%=Session["Vechilevalue"]%>';

               
                var obj = {};
                obj.ID = ID;

                get(obj);
            });

        });
        

            function get(obj) {
                debugger;
                var ins = {};
                ins.Vechile_ID = obj.Vechile_ID;

                $.ajax({
                    type: "POST",
                    url: "M.aspx/insert",
                    contentType: "application/json;charset=utf-8",
                    data:JSON.stringify(ins),
                    dataType: "json",
                    success: function (result) {
                        
                     

                    },
                    error:function(error)
                    {
                        var r = error.responseText;
                        var errorMessage = r.Message;
                         alert(errorMessage);
                        alert(r);
                        alert("error");

                    }

                });
            };
       
        
    </script>
`

Uncaught TypeError: Cannot read property 'aDataSort' of undefined(…)
Maintenance.aspx:338 Array[3]
jquery.dataTables.min.js:83 Uncaught TypeError: Cannot read property 'parentNode' of null(…)
Maintenance.aspx:291 Array[2]
jquery.dataTables.min.js:83 Uncaught TypeError: Cannot read property 'parentNode' of null(…)
jquery.dataTables.min.js:83 Uncaught TypeError: Cannot read property 'parentNode' of null(…)
Maintenance.aspx:65 Array[21]
jquery.dataTables.min.js:65 Uncaught TypeError: Cannot read property 'aDataSort' of undefined(…)

Answers

  • allanallan Posts: 63,818Questions: 1Answers: 10,517 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

This discussion has been closed.