Unfortunately I am using UploadToDir.php and I changed the code appropriately but I cannot make it working.
This is what I've added:
- Code: Select all
...................
echo $javascript;
?>
<script type="text/javascript">
function addDeleteIcon()
{
var id = $('id').value;
var html = $('file_data_input_cell').innerHTML;
var htmlParts = html.split(/<br>/);
if(htmlParts.length == 2)
{
var newHtml = '<table id="file_name_table"><tr><td style="border: none;">'+htmlParts[0]+'</td><td style="border: none;"><ul class="actions"><li class="delete"><a href="javascript: void(0);" onclick="deleteFile(\''+id+'\');" title="Delete '+htmlParts[0]+'"></a></li></ul></td></tr></table>';
newHtml += htmlParts[1];
$('file_data_input_cell').innerHTML = newHtml;
}
}
function deleteFile(id)
{
if(confirm('Are you sure you would like to delete this file?'))
{
toAjaxTableEditor('delete_file',id);
}
}
</script>
<?php
}
function deleteFile($id)
{
$query = "update emp_upload_db set file_data = '', file_name = '', file_type = '' where id = '$id'";
$result = mysql_query($query);
if($result)
{
$this->Editor->retArr[] = array('where' => 'javascript', 'value' => '$("file_name_table").remove();');
}
}
function formatFileSize($col,$size,$row)
{ .........................
then
- Code: Select all
$userActions = array('delete_file' => array(&$this,'deleteFile'));
$this->Editor->setConfig('userActions',$userActions);
and finally
- Code: Select all
.........................
$this->Editor->main();
if($this->Editor->data->action == 'edit_row')
{
$this->Editor->retArr[] = array('where' => 'javascript', 'value' => 'addDeleteIcon();');
}
echo $this->Editor->jsonEncode($this->Editor->retArr);
........................
but I cannot get the delete icon at all...
Am I missing something?
THANKS a LOT for your hard work.