Manually set shown item as per request input

Hello, I want to make this grid paging displayed item into dynamic as user input the number..
there will be still "ALL" option and user can input the number he want to display the item per page.
thanks


3 Replies 1 reply marked as answer

PS Pavithra Subramaniyam Syncfusion Team July 27, 2022 04:53 PM UTC

Hi Bernadus,


Thanks for contacting Syncfusion support


You can achieve your requirement by appending the input element into the Grid pager when the “created” event is triggered. Please refer to the below code example and sample link for more information.


function created(e) {

  var grid = document.getElementById('Grid').ej2_instances[0];

 

  let pagerInput = ej.base.createElement('input', {

    className: 'e-pagerdropdown',

  });

  var pager = grid.getPager();

  pager.querySelector('.e-pagerdropdown').style.display = 'none';

 

  pager

    .querySelector('.e-pagesizes')

    .insertBefore(pagerInput, pager.querySelector('.e-pagerdropdown'));

 

  pagerInput.addEventListener(

    'keydown',

 

    function (args) {

      if (args.keyCode == 13) {

        if (args.target.value == 'All') {

          grid.pageSettings.pageSize = grid.pageSettings.totalRecordsCount;

        } else {

          grid.pageSettings.pageSize = parseInt(args.target.value);

        }

      }

    }.bind(this)

  );

},

 


Regards,

Pavithra S


Marked as answer

BR Bernadus Rangga Kresna Waskita July 29, 2022 03:44 AM UTC

Beautifull ty



PS Pavithra Subramaniyam Syncfusion Team August 1, 2022 06:55 AM UTC

Hi Bernadus,


Thanks for your update.


Please get back to us if you need further assistance on this.


Regards,

Pavithra S


Loader.
Up arrow icon