How to display datatable rows with a selected row from another Datatable

How to display datatable rows with a selected row from another Datatable

DivikiranDivikiran Posts: 5Questions: 0Answers: 0
edited May 2012 in TableTools
Hi All,

I am trying to display a datatable with the selection of row from another datatable. it works for first selection though.

I have tried below

function loadPersonelDetails(aData) {
//Profile Name
$("#tbName").val(aData.PermissionProfile.ProfileName);
//Profile Description
$("#tbDescription").val(aData.PermissionProfile.ProfileDesc);
//Profile ID (Hidden)
$("#cphContent_hdnPermissionProfileID").val(aData.PermissionProfile.PermissionProfileID);

//tbID
$("#tbID").val(aData.PermissionProfile.PermissionProfileID);

}

//On Selction : Load Data on page
$('#PermissionProfileTable tbody tr').live('click', function (event) {
var aData = oTable.fnGetData(this); // get datarow
loadPersonelDetails(aData);
});

when we select the next row or selection to show relevant data in second datatable it's working.

basically second datatable is not reinitializing again.

Any workaround or alternate solutions.

Thanks in advance
Divikiran

Replies

  • DivikiranDivikiran Posts: 5Questions: 0Answers: 0
    doing this
    $('#PermissionProfileTable tbody tr').live('click', function (event) {
    $(this).toggleClass('row_selected');
    var aData = oTable.fnGetData(this); // get datarow
    loadPersonelDetails(aData);


    });

    causeing 'this' data to be replaced with new datatable 'this' data
  • DivikiranDivikiran Posts: 5Questions: 0Answers: 0
    Quick update:

    I need way to select a row information from the datatable1 to pass them as parameters to second datatable.

    This works fine for first time, but second time it fails.

    "var aData = oTable.fnGetData(this)" normally does the job, but when second table comes and overwrites 'this' with its information.

    is there any other means to achive node information (this out using 'this')
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It looks to me that you are using basically the method I would suggest - but what I'm not clear on is what loadPresonalDetails() is doing. Are you destroying the old table, or is it Ajax loading data or something else?

    The way I would suggest doing it is to use fnClearTable and then fnAddData to clear the old data from the table and then insert your new data.

    Allan
This discussion has been closed.