Hello again.
I'm trying to get my datagrid to update and delete records from the database, but I run into the problem that the destroyUrl property is not working. I haven't put all logic inside my destroy.php file to actually delete a record, I wanted to try something simple before that, just update a record in the database with 'test delete succeeded', so that I rule out everything else.
The updateUrl correctly updates the database with 'test update succeeded', but the destroyUrl is not doing anything.
I have my datagrid initialized like this:
jQuery( document ).ready( function ( $ ) {
$( '#dg' ).edatagrid({
url: 'get.php',
updateUrl: 'update.php',
destroyUrl: 'destroy.php',
title: 'my datagrid',
width: 'auto',
height: '400',
pagination: true,
singleSelect: true,
idField: 'option_id',
fitColumns: true,
rownumbers: true,
sortName: 'option_id',
sortOrder: 'asc',
pageSize: 10,
pageList: [ 10, 20, 30 ],
columns: columnsArray,
onBeforeEdit: function( index, row ) {
row.editing = true;
updateActions( index );
},
onAfterEdit: function( index, row ) {
row.editing = false;
updateActions( index );
},
onCancelEdit: function( index, row ) {
row.editing = false;
updateActions( index );
}
});
});
function updateActions( index ) {
jQuery( '#dg' ).datagrid( 'updateRow', {
index: index,
row: {}
});
}
function getRowIndex( target ) {
var tr = jQuery( target ).closest( 'tr.datagrid-row' );
return parseInt( tr.attr( 'datagrid-row-index' ) );
}
function editrow( target ) {
jQuery( '#dg' ).datagrid( 'beginEdit', getRowIndex( target ) );
}
function deleterow( target ) {
jQuery.messager.confirm( 'Confirm', 'Are you sure you want to delete this record?', function( r ) {
if ( r ){
jQuery( '#dg' ).datagrid( 'deleteRow', getRowIndex( target ) );
}
});
}
function saverow( target ) {
jQuery( '#dg' ).datagrid( 'endEdit', getRowIndex( target ) )
}
function cancelrow( target ) {
jQuery( '#dg' ).datagrid( 'cancelEdit', getRowIndex( target ) );
}
Am I missing something here?
Thank you in advance for your help.