How I Remove Show And Search Option

How I Remove Show And Search Option

Abdulmajeed511Abdulmajeed511 Posts: 5Questions: 1Answers: 0

Hello , I want to use paging Type but I want to use Only the Next And Previous without Show to filter How many Rows And remove the search button , And how to change how many rows to show to be fixed number (5 for Example)
And Sorry for advance if my Question Answered before

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Answer ✓

    search can be used to disable search (and remove the search input). pagingType to change the paging buttons and info to remove the table information (assuming I've understood that point).

    The full list of options is available here.

    Allan

  • Abdulmajeed511Abdulmajeed511 Posts: 5Questions: 1Answers: 0

    `

    $(document).ready(function () { $('#example').DataTable({ pagingType: 'simple', searching: false, ordering: false, info: false, "lengthMenu": [2] }); });

    `

    this what i was looking for , I used this for multiple choice but unfortunately when i click submit it's sending empty data is there a way to fix it ?

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

    I used this for multiple choice but unfortunately when i click submit it's sending empty data is there a way to fix it ?

    How are you doing this? Please post a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • Abdulmajeed511Abdulmajeed511 Posts: 5Questions: 1Answers: 0

    I did it in my .net 6 MVC project and here is my test case
    note : i use foreach to load the question with answer and my function filldata was working before i use the datatable

    live.datatables.net/zagujeji/2/edit

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

    Not sure why you would want to put a form into DataTables rows like that, but it does appear to be submitting for me in your example:

    It is 404 obviously, but note the query parameters (since it is a GET request form that is setup here).

    Allan

  • Abdulmajeed511Abdulmajeed511 Posts: 5Questions: 1Answers: 0
    edited October 2022

    because I was thinking this is the fastest way to create Previous Next Functionality ,

    In my example I just put php to show my code but i'm using .net mvc
    Update : after i add stateSave: true it's sending the last page before clicking submit

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Answer ✓

    I see. I think you are going to run into a bunch of issues with this approach. DataTables removes the DOM elements that it doesn't need, so yes, the form would only submit the values for the current DataTables page. See this example for more details and a possible workaround. But I'd think for this, it would probably be easier to implement just simple next/previous buttons with display:none elements.

    Allan

  • Abdulmajeed511Abdulmajeed511 Posts: 5Questions: 1Answers: 0

    Thanks Allan this is the best community I found in the programming world !

Sign In or Register to comment.