How can i Pass create new entry form values of editor DataTable in to my python file

How can i Pass create new entry form values of editor DataTable in to my python file

NirmalaSudhirrNirmalaSudhirr Posts: 7Questions: 3Answers: 0

I have a problem with my Editor DataTable. I cant able to pass Editor DataTable "create new entry" form value to my python file. I dont know what am doing wrong or what am I missing. Here is my Script part :

var editor;
var oTable;
function getStudentdetails(id) {
editor = new $.fn.dataTable.Editor({
ajaxUrl: {
"create": "/addStudentdetails",
"edit": "/editStudentdetails",
"remove": "/deleteStudentdetails"
},
dom: "Tfrtip",
table: "#table_student_details",
fields: [ {
label: "Id:",
name: "id",
attr: {
maxlength: 50,
name:"id",
placeholder: 'ID'
}
}, {
label: "Name:",
name: "name"
}
]
});

oTable = $('#table_student_details').DataTable({
dom: "Tfrtip",
destroy: true,
ajax: {
"url": url_prefix + "/getStudentDetails",
"data": function(d) {
d.id = id;
}
},
tableTools: {
sRowSelect: "os",
aButtons: [{
sExtends: "editor_create",
editor: editor
}, {
sExtends: "editor_edit",
editor: editor
}, {
sExtends: "editor_remove",
editor: editor
}]
}
});
}

when I try to store the new record from the create New Entry form i get nothing in the python file.

Python file.

def addStudentDetails(self, form=None):
if not form:
form = self.request.form
handler = self.getDBHandler()
values = {}
id = form.get('id')
name = form.get('name')
print "ID:",id // it gives ID: None
print "NAME:",name // it gives NAME: None

I dont know why cant i able to get the Create New Entry Form values in my python file. Thanks in advance.

This discussion has been closed.