fnDeleteRow driving me crazy!
fnDeleteRow driving me crazy!
awvidmer
Posts: 8Questions: 0Answers: 0
Hi, Allan:
I'm using fullCalendar along with dataTables 1.9.1, and I'm trying to get a row to delete in a dataTable when I click an event in fullCalendar. I've been successful in identifying the proper row in the dataTable (both as an index or as a tr element), the id logged is correct, and a row deletes, but it's a completely random one. Could you have a quick peek at this code and see if you spot something? Would the row grouping extension have any effect? (Not using here, but elsewhere). Many thanks! --Tony
$(document).ready(function() {
var oTable = $('#dataTables3dadmin').dataTable();
// page is now ready, initialize the calendar...
$('#full_calendar4').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultView: 'month',
height: 600,
eventSources: [{
url: '/pevents',
color: '#83AEFF',
textColor: 'black',
className: 'tevents',
ignoreTimezone: true
}
],
eventRender: function(event, element) {
element.find('.fc-event-title').append(": " + "" + event.description + "");
},
eventClick: function(event) {
//setting up oTable var here!
var pevt = event.id;
var rid = ($('#evnt_'+ pevt));
console.log(rid);
if (confirm("Remove Event from Poketinerary?")) {
$.ajax({
type:'DELETE',
url: '/pevents/1',
data:'event_id='+event.id,
});
$(this).fadeOut();
//here's the delete call!
oTable.fnDeleteRow(rid);
return false;
} else {
return false;
}
}
})
});
I'm using fullCalendar along with dataTables 1.9.1, and I'm trying to get a row to delete in a dataTable when I click an event in fullCalendar. I've been successful in identifying the proper row in the dataTable (both as an index or as a tr element), the id logged is correct, and a row deletes, but it's a completely random one. Could you have a quick peek at this code and see if you spot something? Would the row grouping extension have any effect? (Not using here, but elsewhere). Many thanks! --Tony
$(document).ready(function() {
var oTable = $('#dataTables3dadmin').dataTable();
// page is now ready, initialize the calendar...
$('#full_calendar4').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultView: 'month',
height: 600,
eventSources: [{
url: '/pevents',
color: '#83AEFF',
textColor: 'black',
className: 'tevents',
ignoreTimezone: true
}
],
eventRender: function(event, element) {
element.find('.fc-event-title').append(": " + "" + event.description + "");
},
eventClick: function(event) {
//setting up oTable var here!
var pevt = event.id;
var rid = ($('#evnt_'+ pevt));
console.log(rid);
if (confirm("Remove Event from Poketinerary?")) {
$.ajax({
type:'DELETE',
url: '/pevents/1',
data:'event_id='+event.id,
});
$(this).fadeOut();
//here's the delete call!
oTable.fnDeleteRow(rid);
return false;
} else {
return false;
}
}
})
});
This discussion has been closed.
Replies