I am using the jqxgrids plugin with the context menu option enabled in order to display some data and using the context menu option, I want to add an option where the user can upload a document for the selected row but I want to be able to send the row id together with the document on submit. My problem with the code below is that, it only works for the first time after that when I try to upload a new document, the upload is fine but the same row id gets sent every time.
if ($.trim($(args).text()) == 'Documente') {
editrow = rowindex;
var offset = $('#jqxgrid').offset();
$('#DocHelper').jqxWindow({ width: 400, height:150, position: { x: parseInt(offset.left) + 100, y: parseInt(offset.top) + 20 } });
// get the clicked row's data and initialize the input fields.
var dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
$('#fileuploader').uploadFile({
url:'xpages/logis/upload.php',
multiple:true,
dynamicFormData: function()
{
var dataX = { id: dataRecord.id}
return dataX;
},
showStatusAfterSuccess:false,
fileName:'myfile',
onSuccess:function() {
$('#DocHelper').jqxWindow('close');
$('#fileuploader').remove();
console.log(dataRecord.id);
}
});
}
What am I missing?
L.E. I think the problem is here
dynamicFormData: function()
{
var dataX = { id: dataRecord.id}
return dataX;
},
it's like the dataX variable doesn't get updated when the right click event fires, because I can see correct id when this gets executed
console.log(dataRecord.id);
Thanks.