aLengthMenu and server-side processing

aLengthMenu and server-side processing

DaniloDanilo Posts: 6Questions: 0Answers: 0
edited August 2010 in General
Hi Allen,

I have a DT that's processing server-side and with upgrading to 1.7.0 I changed the sLengthMenu back to something with _MENU_ and put my options into the new aLengthMenu instead.
I have a 2D array here with a sring "all" for the option -1 (all records). Now when I chose "all" in the server-side example and filter additionally, then the info under the table reads "Showing 1 to -1 of 2 entries (filtered from 25 total entries)".
With all other options (10, 25, etc.) it's working correct, showing "1 to 2 of 2", etc.

I have a feeling this is a simple issue but am totally stuck. Please point me in the right direction what to change in the server-side example.

Thanks.

Danilo

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Danilo,

    Actually, I think you've found the first confirmed bug in 1.7.0... :-(. You are right that it's a small thing, but and issue none-the-less. The fix is to find the function "fnDisplayEnd" and change:

    [code]
    if ( this.oFeatures.bPaginate === false ) {
    [/code]
    to:

    [code]
    if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) {
    [/code]
    1.7.1 probably won't be released for a little while - although I do plan to put this kind of change into a git repository at some point (just need to get a chance to set it up). I might see about putting together a known issues page as well for this kind of thing... Until all that - the above fix will hopefully do the trick for you.

    Regards,
    Allan
  • DaniloDanilo Posts: 6Questions: 0Answers: 0
    Well, thanks for the questionable honour ;-)

    Thanks so much for the fix, now if only I could convince my bosses of a donation (I really try).

    I have one further (silly) question though. I need the minified version for production use. Am I doing this right? I changed

    [code]this.oFeatures.bServerSide?this.oFeatures.bPaginate===false[/code]

    to

    [code]this.oFeatures.bServerSide?(this.oFeatures.bPaginate===false||this._iDisplayLength==-1)[/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes - that looks correct.

    Google Compiler is quite amazing - I hadn't quite appreciated how much code it would rewrite... :-)

    Regards,
    Allan
  • DaniloDanilo Posts: 6Questions: 0Answers: 0
    Thanks again so much, Allen.
  • therubbletherubble Posts: 3Questions: 0Answers: 0
    [code]"aLengthMenu": [[36, 48, 60], [36, 48, 60]][/code]

    Again using server side paging and it passes 10 as the pagesize, if you select a different page size and then click back on 36 everything works fine.

    I posted this in here as I thought it was quite relevant to the original post.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi therubble,

    This is actually intentional... :-). The definition you have will effect the options that the user can choose from, but not the initial length - as you are seeing. To change the initial length you need to define iDisplayLength ( http://datatables.net/usage/options#iDisplayLength ).

    Allan
This discussion has been closed.