@@ -131,31 +131,35 @@ Checkboxes.prototype = {
131
131
132
132
133
133
//
134
- // WORKAROUNDS:
134
+ // OPTIONS
135
135
//
136
- // DataTables doesn't support natively ability to modify settings on the fly.
137
- // The following code is a workaround that deals with possible consequences.
138
-
139
- DataTable . ext . internal . _fnApplyColumnDefs ( ctx , [ {
140
- 'targets' : i ,
141
- 'searchable' : false ,
142
- 'orderable' : false ,
143
- 'width' :'1%' ,
144
- 'className' : 'dt-body-center' ,
145
- 'render' : function ( data , type , full , meta ) {
146
- if ( type === 'display' ) {
147
- data = '<input type="checkbox" class="dt-checkboxes">' ;
148
- }
149
- return data ;
150
- }
151
- } ] , { } , function ( iCol , oDef ) {
152
- DataTable . ext . internal . _fnColumnOptions ( ctx , iCol , oDef ) ;
153
- } ) ;
154
136
155
- // Remove "sorting" class
137
+ var colOptions = {
138
+ 'searchable' : false ,
139
+ 'orderable' : false
140
+ } ;
141
+
142
+ if ( ctx . aoColumns [ i ] . sClass === '' ) {
143
+ colOptions [ 'className' ] = 'dt-body-center' ;
144
+ }
145
+
146
+ if ( ctx . aoColumns [ i ] . sWidthOrig === null ) {
147
+ colOptions [ 'width' ] = '1%' ;
148
+ }
149
+
150
+ if ( ctx . aoColumns [ i ] . mRender === null ) {
151
+ colOptions [ 'render' ] = function ( ) {
152
+ return '<input type="checkbox" class="dt-checkboxes">' ;
153
+ } ;
154
+ }
155
+
156
+ DataTable . ext . internal . _fnColumnOptions ( ctx , i , colOptions ) ;
157
+
158
+
159
+ // WORKAROUND: Remove "sorting" class
156
160
$colHeader . removeClass ( 'sorting' ) ;
157
161
158
- // Detach all event handlers for this column
162
+ // WORKAROUND: Detach all event handlers for this column
159
163
$colHeader . off ( '.dt' ) ;
160
164
161
165
0 commit comments