lengthMenu -1 isn't working for me, using oracle database.

lengthMenu -1 isn't working for me, using oracle database.

jwen11jwen11 Posts: 4Questions: 1Answers: 0

serverSide: true,
ordering: false,
searching: true,
serverMethod: 'post',
lengthMenu: [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
What might be the prob.?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    You will need to debug your server script to find the problem. lengthMenu -1 means all rows. Your server script is expected to return all the rows. Are you using a Datatables supplied server side processing script or your own?

    Kevin

  • jwen11jwen11 Posts: 4Questions: 1Answers: 0

    hi Kevin,
    I think I am.

    trying to log data result.

    {draw: 2, columns: Array(11), order: Array(0), start: 0, length: -1, …}
    {draw: 2, recordsTotal: 188, recordsFiltered: 188, data: Array(0)}

    is this normal when trying to show all? length: -1

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954
    Answer ✓

    I think I am.

    Not sure what you are. referring to. If its the Datatables script question let us knwo which script you are using.

    data: Array(0)

    Your server script is not returning any rows. You probably need to add a check for length: -1 so that you don't add a where condition.

    recordsTotal: 188

    If you only have 188 records in the table then you don't need server side processing. Turing off server side processing will make everything easier.

    Kevin

  • jwen11jwen11 Posts: 4Questions: 1Answers: 0

    @kthorngren i mean yes im using Datatables script.
    but when im going to show [100] entries it will display 100 rows
    and trying to show [All] entries it says "No matching records found"
    im just testing it using server side processing cuz this will populate soon.

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    Which DataTables script are you using? We only provide Oracle support for our Editor libraries and they should work okay with the -1 (show all) option.

    Basically, wherever in the script the limit and offset are being applied, that should only be applied if the length list is not -1.

    Allan

  • jwen11jwen11 Posts: 4Questions: 1Answers: 0

    @allan
    1.10.21.
    Thanks by the way.
    maybe I need to figure this out. why..

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    edited August 2022

    Have a look at whatever server-side script you are using (you didn't say which one, or if it is custom made) and look at how it is applying the LIMIT and OFFSET. That's the key part for this question.

    Allan

Sign In or Register to comment.