editor not posting dasta to server
editor not posting dasta to server
mailbothra
Posts: 12Questions: 4Answers: 0
hi I am using the below code with asp.net as backend. Though I can read data but when I want to add or edit data it is not going to server and there is no error as such .all the properties in asp is showing null.
I am in a trial for editor
editor = new $.fn.dataTable.Editor({
idSrc: 'Sslno',
ajax: {
create: {
dataType: 'json',
type: 'POST',
url: '../Sale/create',
},
edit: {
type: 'PUT',
url: '../Sale/create'
},
},
"table": '#example',
"fields": [{
"label": "Sslno:",
"name": "Sslno"
}, {
"label": "Custid:",
"name": "Custid",
}, {
"label": "Invno:",
"name": "Invno"
}, {
"label": "Invdt:",
"name": "Invdt",
"type": 'datetime',
"def": function () { return new Date(); },
"format": 'YYYY/MM/DD',
}, {
"label": "Invduedt:",
"name": "Invduedt",
type: 'datetime',
def: function () { return new Date(); },
format: 'YYYY/MM/DD',
}, {
"label": "Currency:",
"name": "Currency",
}, {
"label": "ExchRate:",
"name": "Currate"
},
{
"label": "Comments:",
"name": "Comments"
}
]
});
var table = $('#example').dataTable({
"processing": true,
"serverSide": true,
dom: 'Bfrtip',
ajax: {
url: "../Sale/indexto?yearid=2013&username=admin",
dataSrc: '',
},
idSrc: 'Sslno',
columns: [
{
data: null,
defaultContent: '',
className: 'select-checkbox',
orderable: false
},
{ data: "Sslno" },
{ data: "Custid" },
{ data: "Invno" },
{ data: "Invdt" },
{ data: "Invduedt" },
{ data: "Terms" },
{ data: "Currency" },
{
data: "Currate",
render: $.fn.dataTable.render.number(',', '.', 5)
},
{
data: "Amount",
render: $.fn.dataTable.render.number(',', '.', 2, '$')
},
{ data: "Comments" },
],
/* keys: {
columns: ':not(:first-child)',
editor: editor
}, **/
select: {
style: 'os',
selector: 'td:first-child',
blurable: true
},
buttons: [
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{ extend: "remove", editor: editor },
{
extend: 'collection',
text: 'Export',
buttons: [
'copy',
'excel',
'csv',
'pdf',
'print'
]
}
]
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Are you able to link to a page showing the issue please? Failing that, I would suggest checking in your browser's "Network" inspector what the request to the server contains. I don't see anything int he above code that would case it not to submit the data I'm afraid.
Allan
in network inspector request to server contains the data and request is ok .it is calling the create method in controller but then there is no data.
my Jason structure is like below does it matter ? I am struggling with it for last few days .
[{"Yearid":"2013","Sslno":40452,"Invno":"66","Invdt":"\/Date(1382112000000)\/","Invduedt":"\/Date(1430668800000)\/","Currency":"USD","Currate":5.00000,"Custid":"Berkshire}]
if anyways I can send u the screen shot ?
because the things are in my local computer so no links as such is available
That looks like the data that is being returned from the server (also note that it isn't in the format required by Editor from a create/edit/delete request).
I'm looking to know what parameters are being sent to the server. This will likely be under the request headers.
Regarding a screenshot - they can't be hosted on this forum just now. You'd need to use a file upload service.
Allan