fnUpdate for entire row using JSON returned object

fnUpdate for entire row using JSON returned object

RamprakashRamprakash Posts: 14Questions: 7Answers: 1

In my jsp i am populating rows with value from json returned array of objects using aoColumns.. It works good but when I try to update entire row using another json returned object in some other function it shows error as "DataTables warning: table id=example - Requested unknown parameter 'clientId' for row 0. For more information about this error, please see http://datatables.net/tn/4"

Here is my code:

To get and populate table rows

table=$('#example').dataTable({
"processing":true,
"serverSide":true,
"pagingType": "full_numbers",
"ajax":{
"url":"/DashBoard/FetchClients",
"dataType":"json",
"data": {alertId: id},
"type":"POST"
},
"aoColumns":[
{"mData": "clientId"},
{"mData": "clientName"},
{"mData": "AliasName"},
{"mData": "Status"},
{"mData": "Time"},
{"mData": "Date"},
],
"aoColumnDefs":[{"aTargets":[0,1,2,3,4,5],
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {

                              $(nTd).attr('id', oData.DT_RowId+""+sData);

                          }
                        }],
                        "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
                              if ( sortId == aData.DT_RowId )
                              {
                                  $(nRow).show();
                              }
                              else
                                  {
                                    $(nRow).hide();
                                  }
                            }//"aoColumnDefs": [{ "bVisible": false, "aTargets": [6], "iDataSort": 1, "aTargets": [ 6 ] }]
            });

To update

$('document').ready(function(){
var table=$('#example').dataTable();
alert('Before ajax');
$.ajax({
url:'/DashBoard/FetchUpdates',
type:'post',
dataType:'json',
data: {isDefault: isDefault,selectedId : 'A1'},
cache: false,
contentType: 'application/x-www-form-urlencoded',
success: function(data) {
$.each(data.aaData,function(index,aaData)
{

                        var Status=aaData.Status;
                        var Time=aaData.Time;
                        var Date=aaData.Date;
                        var AliasName=aaData.AliasName;
                        var clientName=aaData.clientName;
                        var rowId=aaData.DT_RowId;
                        var clientId=aaData.clientId;
                    //if(aaData.target=="Tabs")
                        //  addTab(aaData.alertId,aaData.Date,aaData.Time,aaData.Status,aaData.Description,aaData.Color);
                    //$('#example').find('tr').each(function(){
                        //  if($(this).attr('id')==rowId)
                            //  {
                                //  rownum=$(this).index();
                                    table.fnUpdate([clientId,clientName,AliasName,Status,Time,Date],rownum++);
                                    alert(clientId+' '+clientName+' '+AliasName+' '+Status+' '+Time+' '+Date);
                                //}
                            //});

                    });

        } 
        });
    table.draw();

});

This discussion has been closed.