I was not able to do filtering,paging on table. Below is the snapshot

I was not able to do filtering,paging on table. Below is the snapshot

kishorkabadikishorkabadi Posts: 9Questions: 4Answers: 0
edited May 2018 in Free community support
 var table = $('.table');
 $.ajax({
            url: '../../EmployeeAttendance/ShowRealTimeAttendance',//calling Web Service Method
            type: 'POST',
            contentType: 'application/json;',
            dataType: 'json',
            success: function (result) {
                
                for (var i = 0 ; i < result.length; i++) {

                    var tr = document.getElementById("row" + result[i].Emp_ID);
                   
                    if (tr == 'undefined' || tr == null) {
                        //here i was append row to table
                        $(table).find('tbody').append("<tr id=row" + result[i].Emp_ID + "><td class='sorting' id=td1" + result[i].Emp_ID + ">" + result[i].EmployeeName + "</td><td id=td2" + result[i].Emp_ID + ">" + getDateString(new Date(result[i].Date), "d-M-y") + "</td><td id=td3" + result[i].Emp_ID + ">" + getDateString(new Date(result[i].InTime), "h:m b") + "</td><td id=td4" + result[i].Emp_ID + "></td></tr>");

                       
                    }

                    else {
                        //here i was update the column value of row to table
                        var td4 = document.getElementById("td4" + result[i].Emp_ID);

                        if (td4.innerText == '') {


                            document.getElementById("td4" + result[i].Emp_ID).innerHTML = getDateString(new Date(result[i].OutTime), "h:m b");
                           
                        }
                    }
                }
               
            }

        });

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    It looks like you haven't initialised the table, so it's not surprising. It would be worth looking at the Ajax examples in this section of the manual.

    Colin

This discussion has been closed.