यह मेरे लिए काम करता है। दस्तावेज़ तैयार फ़ंक्शन में मैं HTML तालिका के परिवर्तित संस्करण को एक चर में आवंटित करता हूं और जब एक बटन क्लिक किया जाता है तो मैं JQuery के साथ माता-पिता/बच्चों के माध्यम से जाता हूं और लाइब्रेरी के fnDeleteRow() फ़ंक्शन में पैरामीटर के रूप में प्राप्त पंक्ति भेजता हूं।
लाइब्रेरी फ़ंक्शन से टिप्पणियां यहां दी गई हैं। और पुस्तकालय में उल्लेख किया गया एक उदाहरण।
/**
* Remove a row for the table
* @param {mixed} target The index of the row from aoData to be deleted, or
* the TR element you want to delete
* @param {function|null} [callBack] Callback function
* @param {bool} [redraw=true] Redraw the table or not
* @returns {array} The row that was deleted
* @dtopt API
* @deprecated Since v1.10
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* // Immediately remove the first row
* oTable.fnDeleteRow(0);
* });
*/
// And here's how it worked for me.
var oTable;
$("document").ready(function() {
oTable = $("#myTable").dataTable();
});
//Remove/Delete button's click.
$("a[name='deleteColumn']").click(function() {
var $row = $(this).parent().parent();
oTable.fnDeleteRow($row);
});
स्रोत
2016-03-21 17:08:05
अधिक जानकारी की आवश्यकता है। क्या आप अपने डेटाटेबल को पॉप्युलेट करने के लिए AJAX का उपयोग करते हैं या आप एक स्थिर HTML तालिका को परिवर्तित कर रहे हैं? इसके अलावा: डेटा अब सटीक क्यों नहीं है? डेटा को क्रमशः tr (और संबंधित आईडी टैग) को स्थानांतरित नहीं करता है? – r00fus