Page length - lengthMenu not implemented in Serverside
Page length - lengthMenu not implemented in Serverside
Am I correct in concluding that lengthMenu is not available in server side?
I'd like the user to be able to select how many records they have on the page, primarily so they can view 100's of records occasionally (mainly for exporting) while generally viewing an aesthetic few. More specifically, my user moaned that she now couldn't choose for herself, as she had been able to before we went to server side.
I guess I could implement my own menu and .hide() all records over a threshold, although that might be a performance hit bringing back all the (say, 500) records every time.
Thanks,
Rob
Replies
No, you aren't. Why do you think it isn't available? All you need to do is turn paging on. Then the length menu appears automatically.
I have just tested it: The default length menu appears when paging is turned on. But you can't change the defaults using "pageLength" and "lengthMenu". Server side ignores those custom settings. Amazing. My users were ok with the default settings for paging. So I've never had an issue with that.
Maybe this FAQ explains the issue?
Kevin
While I couldn't change "pageLength" and "lengthMenu" using the intialization options I was able to change page length using an event handler.
This worked with my server side table:
Ahh, perhaps it is not available in Editor then. There is not a single example of lengthMenu in the Editor examples. I switched to ss & using Editor about the same time.
Certainly I can set pageLength, but lengthMenu instead does nothing.
Is it available in Editor?
Did you read the FAQ I linked to. I think it will answer your question.
Kevin
Kevin,
This one?
I have:
The lower-case L is there.
Thanks,
Rob
Your code snippet works in this test case:
http://live.datatables.net/pidolijo/1/edit
Maybe you have
lengthMenu
set to false in your Datatables init code or a jQuery or Javascript statement removing the element from the page. Server Side Processing and the Editor support the use of the Length Menu. Please update the test case to show the issue or provide a link to your page so we can help debug.Kevin
Kevin,
that example isn't serverside, I think.
Is it okay to PM you a link?
Ok, since you still doubt the length menu works with server side processing I created a new test case with SSP, Editor, Search Panes, Search Builder, Excel and PDF buttons.
http://live.datatables.net/guwafemu/271/edit
Changing the page length works. Note that SP and SB don't work as the server script doesn't support the protocol needed for them to work.
You can PM me the link but I don't work for Datatables. If you prefer you can PM the link to Allan.
Kevin
Yup - drop me the PM please. Kevin is an amazing person who helps out in the forum, but debugging stuff should come to me so we don't abuse his goodwill
Allan
Kevin, wow, than - you've provided a very clear illustration. I'll have another look at my code and if I still can't solve it I will PM to Allan.
Thanks for all your time and effort, much appreciated.
Rob
Sorry, you guys lost me
But, never mind...
If I look at your initial question, Rob, I think my suggestion works:
Using serverSide this would be the key table settings:
Combined with this event handler you should get what you need:
You should have the standard page length menu and an initial page length of 5 instead of the default 20. Afterwards the user can choose whatever she likes.
This is what you should see:
Isn't that what you want? Am I missing something here?
Kevin, I found the problem going through my code line by line. I misunderstood the lengthChange param and had it set to false! Agggh! But sorted now. I'm very grateful for your time.
rf1234, yes I can do that now - processing is quick with smaller numbers, but if they need to export a load of data they can choose to do so.
Allan, sorry to waste your time.
Thanks all, great support.
Rob
Not sure how to mark this thread answered...
I think you can accept one or several answers and then you're done
You are welcome! And I agree with you. That's why I am trying to help out every once in a while: Trying to give back some of the support I've been receiving over the years.