Change server-side database table name

Change server-side database table name

binaryechoesbinaryechoes Posts: 2Questions: 0Answers: 0
edited October 2012 in General
Hello all,

This is probably incredibly easy but I'm have trouble finding out the *best* way to send a different database table name to the server script for processing.

When the user first loads the page it will load data from database.tableA. However, if they select a different option from a dropdown menu then it should use database.tableB. I was planning on using onchange and fnServerParams but I'm not certain.

Thanks, any help is greatly appreciated.

Replies

  • binaryechoesbinaryechoes Posts: 2Questions: 0Answers: 0
    edited October 2012
    I went ahead and used fnServerParams - it was easy enough.

    [code]
    var table = $("#select_table").val();
    [/code]
    ..
    [code] "fnServerParams": function ( aoData ) {
    aoData.push( {
    "name": "table_name",
    "value" : table
    });
    }
    [/code]

    I also needed to set the tables width after calling fnDestroy.

    [code]
    $("#my_table").css("width", "100%");
    [/code]
This discussion has been closed.