How to make pagination input read only?

How to make pagination input read only?

yousufsadatyousufsadat Posts: 25Questions: 11Answers: 0

Hello. I am using pagingType as input to see the page number inside the box but I don't want the user to change the page number to go to the desired page. is there a way to make this property read only. Just show the page number inside the box without the ability to change it. This is how my JQuery looks like so far.

var table = $('#esignTable').DataTable({"sDom": '<"top"flp>rt<"bottom"i><"clear">',
          pagingType: 'input',
          pageLength: 5,
          language: {
            "sEmptyTable": " ",
            oPaginate: {
                "sNext": '<img src="../images/integration/SlowRight.jpg">',
                "sPrevious": '<img src="../images/integration/SlowLeft.jpg">',
                "sFirst": '<img src="../images/integration/FastLeft.jpg">',
                "sLast": '<img src="../images/integration/FastRight.jpg">',
            }
          }   
        }); 

Answers

  • yousufsadatyousufsadat Posts: 25Questions: 11Answers: 0

    I am trying to get the highlighted part read only. Thanks

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    The whole point of the pagination "input" extension is to enable the user to type in a page number. Why would you install an extension and then try to cancel its whole purpose?

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    And if you do want that, just modify the extension a little. Add disabled to the input element.

    Allan

  • yousufsadatyousufsadat Posts: 25Questions: 11Answers: 0

    Tangerine. I know what you are saying but this is the requirement, no one wants to make life harder.

    Allan: would i be like this

     pagingType: 'input disabled',
    
  • yousufsadatyousufsadat Posts: 25Questions: 11Answers: 0

    Alright guys, i got it. I did using JQuery. Thanks all.

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    Line 77 of this plug-in - adding nInput.disabled = true; would be all that is needed.

    Allan

  • yousufsadatyousufsadat Posts: 25Questions: 11Answers: 0

    Hi Allan. I am using CDN so I don't know how would it work in that case. But I got it using plain JQuery. I get the class and using attr method setting it to true.

    $(".paginate_input").attr("readonly",true);
    
This discussion has been closed.