Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81685

Sorting a DataTables checkbox column (success but maybe not correct way)

$
0
0
Hi Alan
I want to sort a checkbox column and have managed it BUT given all the documentation on "sSortDataType": "dom-checkbox", etc I can't help but think I am over engineering this. Your comments will be appreciated.

My code is :-
{"sType": "html",		//6		mandateSigned
  "sWidth":   "20px",
  "fnRender": function (oObj) {
	var $checked = '';
	if (oObj.aData[6] == '1') {
	   $checked = "checked='checked'";
	}
	return "<span style='display:none'>"+oObj.aData[6]+'</span><input class="opmCheckbox" value="'+ oObj.aData[6] +'" type="checkbox" '+$checked+' />';
  }
},

The class is there purely to center the checkbox. The default style puts it to the left half outside the <td>

Viewing all articles
Browse latest Browse all 81685

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>