You would have to use serverside processing of the records and handle the pagination yourself, as Jim suggested, by returning only X records (in your case 10, but could be user selectable) to render per 'view' of the datatable. How you do that in SQL depends on if you're using MySQL or MSSQL and what version, but there's plenty of good articles on how to do pagination with both databases (and others) online so I'll skip that here.
Example JS code I use:
$('#entity-table').DataTable( {
'processing': true,
'serverSide': true,
'responsive': true,
'ajax': {
'url': '\link\to\cfm\cfc\or\controller\that\returns\json',
'type': 'POST'
},
"columns": [
{ "data": "columnName1" },
{ "data": "columnName2" },
{ "data": "columnName3" },
{ "data": "COLUMNNAME1" },
{ "data": "COLUMNNAME2" },
{ "data": "COLUMNNAME3" }
]
} );
I, peronally, loop over my returned queries and build an array of structs using struct[ 'columnName1' ] = qGetData.columnName1;, but you can also just have CF return an array of structs and remember (by default) CF returns column names in UPPERCASE and so serializeJSON() of a query will return UPPERCASE column names (so put both in my example).
serverside sends a POST (or GET if you set AJAX to GET, but don't) and you can dump out the form scope to see all their fields it sends in. The drawback to going serverside is that it requires you to handle everything (number of records returned, which page, search, single and multi-column sorting, etc.). The upside is datatables only renders data when it needs it. I do this a lot for tables of data that are encrypted in the database (users, for example) where large datasets would be horribly slow.
datatables in serverside mode expects JSON returned with the following data:
draw - this is the same as passed in by datatables and can be passed through (the number of 'rows' to 'draw' in the table)
recordsTotal - this is the total number of records
recordsFiltered - this is the number of records, out of the total records, that are filtered (by search, typically) - combines with recordsTotal to display 'Showing X number of records out of Y total' in the datatable.
data - this is your array of structs with column names matching those specified in your JS
These names *must* be in lowercase so use struct[ 'draw' ] = x, struct[ 'recordsTotal' ] = y, struct[ 'recordsFiltered' ] = z, and struct[ 'data' ] = [your array of structs] prior to serializeJSON() (or other rendering pipeline, e.g. fw/1 or ColdBox renderData())
HTH
-- Denny