1.10 and a few questions...

1.10 and a few questions...

mihomesmihomes Posts: 165Questions: 23Answers: 0
edited January 2014 in General
Trying to convert some current 1.9.4 code over to 1.10.

[code]
/* Default class modification */
$.extend( $.fn.dataTableExt.oStdClasses, {
"sWrapper": "dataTables_wrapper form-inline",
"sFilterInput": "form-control input-medium",
"sLengthSelect": "form-control input-small"
});
[/code]

For the above I found that classes are being applied correctly except sFilterInput... nothing is applied for it. Why I do not know? For the time being I am manually adding the class by [code]jQuery('#sample_1_wrapper .dataTables_filter input').addClass("form-control input-medium");[/code]

Second thing I've run into so far is disabling sorting for a particular column. In my case the first column in the table is a unique id that I am turning into a checkbox to allow users to check/uncheck rows. Previously I was able to use bSortable : false, but it appears I can no longer do that.

[code]
"columnDefs": [
{
"targets": [ 0 ],
"searchable": false,
"render": function ( data, type, row ) {
return '';
}
}
]

[/code]

How can I turn off sorting for this targeted column?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    1. Can you please link to a test case showing the issue?

    sFilterInput is new in 1.10 and is applied here: https://github.com/DataTables/DataTablesSrc/blob/master/js/core/core.filter.js#L18 . As I say, I'd need a test case to know why it isn't working.

    2. bSortable or `sortable` will still work, but remember that the default aaSorting is `[[0, 'asc']]` and that will be applied to the table. If you don't want that, apply a different default.

    Allan
  • mihomesmihomes Posts: 165Questions: 23Answers: 0
    I was able to disable the sorting for the column with the following. Even though I am not setting an initial sort it was needed for sortable:false to take affect. Thanks!

    [code]
    "aaSorting": [],
    "columnDefs": [
    {
    "targets": [ 0 ],
    "searchable": false,
    "sortable": false,
    "render": function ( data, type, row ) {
    return '';
    }
    }
    ],

    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The `sortable` parameter is used to allow / disallow the user's ability to sort a column. It has no effect on the API or other options such as aaSorting . This will be made clear in the new documentation (it already is, but not yet published).

    Allan
  • mihomesmihomes Posts: 165Questions: 23Answers: 0
    All I know is if I do not specify "aaSorting": [], along with my "sortable": false, line I will get an error with the database processing script. The default script for server-side.
  • netaisllcnetaisllc Posts: 24Questions: 2Answers: 0
    [quote]This will be made clear in the new documentation (it already is, but not yet published).[/quote]
    A, still happy to proofread/copyedit prior to pub.
    KJM
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Thank you! Very much hoping to get a draft up early next week. Its coming along... :-)

    Allan
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    [quote]netaisllc said: A, still happy to proofread/copyedit prior to pub.
    KJM [/quote]
    I'd be happy to help as well, if you like.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes please! I'll drop you both PMs when its up :-)
This discussion has been closed.