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

Cannot save data from inline editing

1 Answer 225 Views
Grid
This is a migrated thread and some comments may be shown as answers.
husni
Top achievements
Rank 1
husni asked on 08 Aug 2015, 09:37 AM

I recently tried the facility for CRUD data using inline editing, I just tried to run the save command but failed. I combine three files:
1. SQL to store data that has been inputted

function spGroup($data){
$db=pDatabase::getInstance();
$inventorygroupname=stripslashes(strip_tags($data[1]));
$query="INSERT INTO inventorygroup (inventorygroupname, status)VALUES('$inventorygroupname',0)";
$rs=$db->query($query);
if($rs){
return true;
}else{
return false;
}
}

2. Javascript to run commands on kendo ui.

var group=(function(){
return{
load:function(){

var ik_data = {
ajax: 1,
mode: "pages",
cl: "inventorygroup",
ikdata: {0:"getGroup"}
};

$.ajax({
url: lokal+"ajax.php",
type: "POST",
dataType: "json",
async:true,
data: ik_data,
success: function(e){
if(e!=false){
var dataSource = new kendo.data.DataSource({
                            schema: {
                                model: {
                                    id: "idinventorygroup",
                                    fields: {
                                        idinventorygroup: { editable: false, nullable: true },
                                        inventorygroupname: { validation: { required: true } }
                                    }
                                }
                            },
transport: {
read: function (s) {
s.success(e);
},
update: function (s) {

url:group.editgroup();
s.success();
},
create: function (s) {

url:group.save();
s.success();
},

parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
                            },
                            batch: true,
                            pageSize: 10
                        });
$("#grid_group").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 550,
toolbar: ["create"],
toolbar: ["create", "save", "cancel"],
columns: [
{ field:"inventorygroupname", title: "Group Name" },
//{ title:"Status", format: "{0:c}", width: "120px", template: kendo.template($("#status").html())},

{
title: "Action",
width: 50,
template: kendo.template($("#edit").html())
},
{ command: [

{
name: "edit",
text: { 
edit: "Edit Data",              
update: "Update",            
cancel: "Cancel"    
}
},

name: "destroy", 
text: "Delete Data"
}
], title: " ", width: "250px" }],
editable: {
mode: "inline",
}
});
}
}

});

},
save:function(a,b){
var inventorygroupname=a;
var idinventorygroup=b;
var ik_data = {
ajax: 1,
mode: "pages",
cl: "inventorygroup",
ikdata: {0:"spGroup",1:inventorygroupname}
};

$.ajax({
url: lokal+"ajax.php",
type: "POST",
dataType: "json",
async:true,
data: ik_data,
success: function(e){
if(e!=false){
group.load();
}
}
});
},​

3. PHP as an object that is used as a variable for the operation of the data.
<script type="text/x-kendo-template" id="edit">
    <button class="btn btn-default btn-sm" type="button" onclick="group.save('${inventorygroupname}')">Edit Data</button>
</script>


I have successfully used this concept to the method of the popup, but for my inline application failed. ask for help. Thank you

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 12 Aug 2015, 06:56 AM

Hello husni,

 

Please excuse us for the delayed response. 

 

I would like to clarify that batch editing functionality is not supported with InLine edit mode. It could be used only with InCell edit mode. The main idea of the InLine edit mode is to sync data source with the server once user is ready editing the item. 

 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
husni
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or