export kısmında tüm tabloyu export ediyor(istediğimde bu) ancak benim tabloda <td></td> içinde <option> 'larım var. Bu select tagı içindeki tüm optionlarıda export ediyor. Acaba bu optionların sadece selected="selected" olanlarını dahil et diyebilir miyim?

Kodum bu:
paste.ofcode.org

<script>
var oTable = null;



var allowance = 90; // extra space needed, found 118 good for offline debugging in firefox

var isInFrame = (window.location != window.parent.location) ? true : false;
var calcWindowHeight = function () {
if (isInFrame) {
return window.innerHeight;
} else {
return window.outerHeight;
}
};
var calcDataTableHeight = function () {
var wHeight = windowHeight - bannerHeight - headerHeight - allowance;
return wHeight + 'px';
};
var getFirstColumnActualWidth = function () {
return $('#example23 thead:first tr:first td:first').css("width");
};

$(document).ready(function () {
bannerHeight = $('#white-box').height();
headerHeight = parseInt($('#example23 thead:first').css("height"), 11);
firstColWidth = getFirstColumnActualWidth();
windowHeight = calcWindowHeight();
var dtHeight = calcDataTableHeight();
//alert('initial ht:'+windowHeight);
var defaultOptions = {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"scrollCollapse": true, // height reduced to what is needed if table is short
"orderCellsTop": false, // we have the phantom row in there now, so this is needed
"fixedColumns": {
"leftColumns": 1
}, // make 1 larger than header_cols on multitable for the legend column
"rowsGroup": [0, ], // 2 in line above means 0,1, 3 means 0,1,2, etc, unless multitable, then subtract 1 before deciding here
"paging": true,
"bInfo": true,
"ordering": true, // replaces "bSort": false

columnDefs: [{
"visible": true,

}]
};

oTable = $('#example23').DataTable(defaultOptions); // lower case is important w/smartresize
//jQuery(function($){
// $(window).smartresize(function(){
// var dtHeight = calcDataTableHeight();
// alert('now '+dtHeight);
// $('div.dataTables_scrollBody').css('height', dtHeight, 'max-height', dtHeight);
// oTable.fnAdjustColumnSizing();
// oTable.fnDraw(true);
// });
//})

});
</script>

 

eğer incelemediyseniz şu sayfayı bir inceliyiniz. selector-modifier ile istediğiniz yapılabilir:

datatables.net

dahinnotha

o sayfaya bakmıştım aslında istediğim selectorden ziyade istemediğim kısmı exclude edecek bir seçenek olup olmadığı idi.

goodman

exportOptions içinde format da belirleyebiliyorsun,

şurda bir örnek yaptım.

jsfiddle.net

koddaki 4, select'in olduğunu kolonun index'i oluyor.

format: {
body: function(data, row, column, node) {
return column === 4 ?
$(node).find(':selected').val() :
data;
}
}

ocanal
1

mobil görünümden çık