Extra parameters for editor on create or edit
Extra parameters for editor on create or edit
whiteday
Posts: 2Questions: 1Answers: 0
Hi,
I've been trying to add extra parameters as above for the editor to send to the server whenever a new item is created or one is edited. There are quite a few examples showing how to add extra parameters, but this only seems to work for the initial GET of the table on the page load. I need to do it for editing. Thanks
This discussion has been closed.
Answers
Never mind, I think I've figured it out. I can either pass parameters in the actual querystring (e.g. /api/staff?TestParam=100). This seems a bit messy.
A second way is maybe using the data parameter for ajax. E.g. :
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: {
url: "/api/staff",
data: { "TestParam": "100" }
}, ...
However "TestParam" is always null in the request for some reason, even though I can see that it's been posted ok in Firebug.
Its easiest to use
ajax.data
as a function with Editor:Allan
I only just fully registered this part:
How are you trying to access it?
$_POST['TestParam']
would be the way in PHP. Are you using PHP or .NET or something else?Allan