alfajango / jquery-dynatable

A more-fun, semantic, alternative to datatables
http://www.dynatable.com
Other
2.78k stars 363 forks source link

Auto sorting on column not 100% working #272

Open ukserversltd opened 7 years ago

ukserversltd commented 7 years ago

Hi guys,

Wondering if someone could help me with something, im trying to get the auto sorting working which is it, it sets the url when you load the page: ?sorts[date]=-1 but you then have to refresh the page for it to work as does not sort right away on page load.

 $.ajax({
        // Uncomment the following to send cross-domain cookies:
        //xhrFields: {withCredentials: true},
        url: $('#fileupload').fileupload('option', 'url'),
        dataType: 'json',
        context: $('#fileupload')[0]

    }).always(function () {
        $(this).removeClass('fileupload-processing');
    }).done(function (result) {
        $(this).fileupload('option', 'done').call(this, $.Event('done'), {result: result});
        $('.table-striped').dynatable({
            dataset: {
                files: result,
                ajaxData: {
                    sorts: { 'date': -1 }
                }
            }
        });
    });