DataTables/TableTools ServerSide SOLR

DataTables/TableTools ServerSide SOLR

crunchfactorycrunchfactory Posts: 29Questions: 8Answers: 2
edited May 2014 in DataTables 1.10

Hi!
I have datatables now working well with SOLR, but when I sort a column, search, or select row numbers, I'd like to do a server query, so sorting actually queries ALL of the records and returns, Search/Filter searches ALL the records, or clicking csv gets all of the records for that query, not just what is currently displayed, etc...

the query in solr for rows is
rows= (whatever amount, etc..)
df= is the default search
fq= is the filter search
sort=fieldname+asc/desc

The csv, I'd like to get ALL of the rows based on their search/filter criteria, etc.. Also, IE8 has to be supported here, is there an earlier version of the flash "copy_csv_xls.swf"?

My code thus far is:

$('#TableResults').dataTable( {
           dom: 'T<"clear">lfrtipr',
            "length": 10,
            "paging": true,
            "lengthMenu": [ [10, 25, 50, 100, 250], [10, 25, 50, 100, 250] ],
            "scrollX": true,
            "scrollY": "374px",
            "scrollCollapse": true,
            "autowidth": true,
            "tableTools": {
                "sSwfPath": "css/copy_csv_xls.swf",
                "aButtons": [ "copy", 
                              {
                    "sExtends": "xls",
                    "sButtonText": "Excel",
                    "sFileName": "*.csv"
                } ]
            },
            "processing": true,
            "serverSide": true,
            "ajax": function ( data, callback, settings ) {
                   $.ajax( {
                     "url": "/Solr/collection1/select",
                     "data": $.extend( {}, data, {'wt':'json', 'q':'id:*', 'rows':'10'} ),
                     "dataType": "jsonp",
                     "jsonp": "json.wrf",
                     "success": function ( json ) {
                       var o = {
                         recordsTotal: json.response.numFound,
                         recordsFiltered: json.response.numFound,
                         data: json.response.docs
                       };
                       
                       callback( o );
                     }
                   } );
                 },
            "aoColumns": [ 
                a jillion columns, etc....

Can I call to the items I listed above similar to how we use "recordsTotal: json.response.numFound", etc...

Thank you!

j

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Also, IE8 has to be supported here, is there an earlier version of the flash "copy_csv_xls.swf"?

    The current version should support IE8 as far as I am aware.

    Regarding the issue about downloading the full record set - the whole point of server-side processing is that only the data needed for the current display is available on the client-side. TableTools is client-side software, so if you want to download the whole data set you with need to switch to client-side processing, or have the server generate the CSV file for you and download it. There is a download plug-in for TableTools which might help with the latter: http://datatables.net/extensions/tabletools/plug-ins .

    Allan

This discussion has been closed.