Hide a column but still use get its contents?

Hide a column but still use get its contents?

MercJonesMercJones Posts: 4Questions: 0Answers: 0
edited March 2012 in General
Hi there. My table pulls data from a php file, and some of this data is editable. Each row is either editable or not editable, so I had the idea to do my query php side, and then pass back a true/false for editable, I did this and put this into the last column. All works fine.

I'm then doing:

var oTable = $('#added_products_table').dataTable();
var current_row = $(this).closest("tr").get(0);

var editable_column = 14;
var editable_column_boolean = $(current_row).children().eq(editable_column).html();

then simply, if(editable_column_boolean == "true") { // allow editing } else {//dont allow editing}

This worked perfectly.

But I don't want to see that column, so tried setting it to not be visible:

{ "sClass": "can_edit_column", "bVisible": false},

which hides it fine, but now editable_column_boolean is always null.

Any ideas please?

Replies

  • MercJonesMercJones Posts: 4Questions: 0Answers: 0
    I've got a temp fix:

    "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
    $.post( "get_editable_status.php", { vendor_item_id: aData[0], qty: quantity},
    function(data){
    $(nRow).attr('data-can_edit',data.can_edit ); //can_edit
    }
    );


    which works.. but not the cleanest of ways, any alternatives?
This discussion has been closed.