Hello Every one,
When We click the delete button it deletes the row on the fly. But it does not send any data by the transport.destroy {} function to the server nor transport.destroy function to call delete action to remove from Database. How can I make it workable (invoke deleteAction) through transport.destroy {} to delete data from server by {command : 'destroy' } Button?
For you convenience, here is my Code for your reviewing :
===================================================
According to the above code, the Delete Button does not invoke our PHP deleteAction() and i need your help.
When We click the delete button it deletes the row on the fly. But it does not send any data by the transport.destroy {} function to the server nor transport.destroy function to call delete action to remove from Database. How can I make it workable (invoke deleteAction) through transport.destroy {} to delete data from server by {command : 'destroy' } Button?
For you convenience, here is my Code for your reviewing :
===================================================
$(
"#grid"
).kendoGrid({
dataSource: {
type:
"json"
,
serverPaging:
true
,
serverFiltering:
false
,
serverSorting:
true
,
batch:
false
,
pageSize: 10,
sort: { field:
"image_date"
, dir:
"desc"
},
schema: {
data:
'data'
,
total:
'total'
,
model: {
id:
"image_file_name"
,
fields: {
image_field: { type:
"string"
/*, editable: false*/
},
image_file_name: { type:
"string"
},
image_file_size: { type:
"numbers"
},
image_date: { type:
"string"
}
}
}
},
error:
function
(e) {
var
json = jQuery.parseJSON(e.responseText);
alert(
"An error has occured: "
+ json.Message);
},
transport: {
read: {
type:
"POST"
,
dataType:
"json"
,
url:
"<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action' => 'grid'), 'adminrout', true) ?>"
,
data : <?php echo $
this
->settings_json_info; ?>,
complete:
function
(e) {
//alert(e.responseText.toSource());
}
},
destroy: {
type:
"GET"
,
dataType:
"json"
,
cache:
false
,
url:
"<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action' => 'delete'), 'adminrout', true) ?>"
,
data : <?php echo $
this
->settings_json_info; ?>,
complete:
function
(e) {
alert(e.responseText.toSource());
}
},
}
},
selectable:
"multiple"
,
change: OnChange,
height: 280,
filterable:
true
,
pageable: {
refresh:
true
,
pageSizes:
true
},
scrollable: {
virtual:
true
},
sortable:
true
,
reorderable:
true
,
resizable:
true
,
columns: [
{ field:
"image_field"
, title:
"Images"
, width: 50, template:
'<img src="<?php echo $this->serverUrl().$this->baseUrl(); ?>/${ image_field }" height="60" />'
},
{ field:
"image_file_name"
, title:
"Name"
, width: 200},
{ field:
"image_file_size"
, title:
"Size"
, width: 100},
{ field:
"image_date"
, title:
"Date"
, width: 100},
{ command: {
name:
"destroy"
,
text:
"Delete"
},
title:
" "
,
width: 100
}
],
editable: {
//disables the deletion functionality
update:
false
,
destroy:
true
}
});
According to the above code, the Delete Button does not invoke our PHP deleteAction() and i need your help.