This is a migrated thread and some comments may be shown as answers.

create ,destroy through php

1 Answer 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SAMI
Top achievements
Rank 1
SAMI asked on 10 Jun 2012, 09:52 AM

Hello,
i have problem with create ,destroy through php
 i use POST,PUT and doesn't work
   <div id="grid"></div>
 
<script type="text/x-kendo-template" id="tab_frs">
<div class="tabstrip">
<ul>
<li class="k-state-active">
Ville
</li>
<li>
Détail Pays
</li>
</ul>
<div>
<div class="frs"></div>
</div>
<div>
<div class='frs-details'>
<ul>
<li><label>Libelle:</label>#= libelle #</li>
<li><label>Code:</label>#= code #</li>
 
</ul>
</div>
</div>
</div>
 
</script>
<script>
$(document).ready(function() {
var element = $("#grid").kendoGrid({
dataSource: {
pageSize:6,
height: 450,
sortable: true,
pageable: true,
selectable: "row",
resizable: true,
filterable: true,
serverPaging: true,
type: "json",
transport: {
 
read:{
url: "fic.php?fic=pays",
dataType: "json",
 },
 
update: {
url: "fic.php?fic=up_pays",
type: "POST"
},
 
create: {
url: "fic.php?fic=add_pays",
type: "PUT"
},
                                destroy: {
                                 
                                    url: "fic.php?fic=des_pays",
                                    dataType: "json",
                                    Type: "POST"
                                },
 
 
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
},
error: function(e) {
alert(e.responseText);
},
 
 
schema: {
 
model: {
id: "IDpays",
fields: {
IDpays: { editable: false, nullable: true },
libelle: { validation: { required: true } },
code: { validation: { required: false} }
 
}
}
}
 
 
},
 
detailTemplate: kendo.template($("#tab_frs").html()),
detailInit: detailInit,
 
dataBound: function() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
},
 
toolbar: ["create"],
columns: [{title: "ID", field: "IDpays" },{ field: "libelle" },{ field: "code" },
{ command: ["edit", "destroy"], title: " ", width: "210px" }],
editable: "popup"
});
});
 
function detailInit(e) {
var detailRow = e.detailRow;
 
detailRow.find(".tabstrip").kendoTabStrip({
animation: {
open: { effects: "fadeIn" }
}
});
 
detailRow.find(".frs").kendoGrid({
dataSource: {
type: "json",
transport: {
read: "fic.php?fic=ville"
},
 
 
pageSize:6,
filter: { field: "IDpays", operator: "eq", value: e.data.IDpays }
},
scrollable: false,
sortable: true,
pageable: true,
selectable: "row",
resizable: true,
change: function() {
document.getElementById("A1").value=this.dataItem(this.select()).IDContact;
 
},
 
columns: [
{ field: "IDville",title:"ID", width: 70 },
{ field: "libelle", width: 100 },]
});
}
</script>

1 Answer, 1 is accepted

Sort by
0
SAMI
Top achievements
Rank 1
answered on 10 Jun 2012, 10:11 AM
i don't Get the ID for create and destroy with DELETE method

i resolved the ploblem with define the method create is PUT and the method destroy is POST

and in the php  i use $_GET[] for get the ID for destroy 
Tags
Grid
Asked by
SAMI
Top achievements
Rank 1
Answers by
SAMI
Top achievements
Rank 1
Share this question
or