Is there any way to change fnServerParams after table has been initialised

Is there any way to change fnServerParams after table has been initialised

gordyrgordyr Posts: 35Questions: 0Answers: 0
edited December 2011 in DataTables 1.8
Is there any way of changing the settings of an already initialised datatable so that I can change content of $user_id in this example and then redraw the table?.

[code]"fnServerParams": function ( aoData ) {
aoData.push( { "name": "user", "value": '' + $user_id + '' } );

}, [/code]

Thanks

Replies

  • allanallan Posts: 61,822Questions: 1Answers: 10,129 Site admin
    [code]
    "fnServerParams": function ( aoData ) {
    var userId = getUserId();
    aoData.push( { "name": "user", "value": '' + userId+ '' } );             
    },
    [/code]

    All you need to do is define the function "getUserId" to do what is says on the tin :-)

    Allan
  • gordyrgordyr Posts: 35Questions: 0Answers: 0
    Sometimes I amaze myself with my own stupidity. I was trying all sorts of complicated things. I actually managed to solve it another way using the reloadAjax plugin to manually reload the table with different userid parameters. Works perfectly but your solution is far more elegant.

    Thanks as always Allan :-)
  • johnlafleur67johnlafleur67 Posts: 1Questions: 0Answers: 0
    thanks allan, and gordyr for posting. I had the same moment of over complicating it.
This discussion has been closed.