JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Data Grid Grid exportData not working with Pager

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #102051
    Dark Beccio
    Member

    HI,
    when i call grid.exportData with pager enabled, data exported are the rows in the first page.
    How can i  export the whole dataSource of the grid with pager?

    #102052
    admin
    Keymaster

    Hi Dark Beccio,
    Could you post a sample which demonstrates that?
    The following code which is a modification of our Data Export example with Paging enabled data exports the full data set, not only the first page’s

    window.Smart('#grid', class {
    get properties() {
    return {
    dataSource: new window.Smart.DataAdapter({
    dataSource: window.generateData(100),
    dataFields: [
    'id: number',
    'firstName: string',
    'lastName: string',
    'productName: string',
    'quantity: number',
    'price: number',
    'total: number'
    ]
    }),
    pager: {
    visible: true
    },
    paging: {
    enabled: true
    },
    columns: [
    'id',
    {
    label: 'First Name', dataField: 'firstName'
    },
    { label: 'Last Name', dataField: 'lastName' },
    { label: 'Product', dataField: 'productName' },
    { label: 'Quantity', dataField: 'quantity', align: 'right', cellsAlign: 'right', },
    { label: 'Unit Price', dataField: 'price', align: 'right', cellsAlign: 'right', cellsFormat: 'c2' },
    { label: 'Total', dataField: 'total', align: 'right', cellsAlign: 'right', cellsFormat: 'c2' }
    ]
    };
    }
    });
    function init() {
    const grid = document.querySelector('jqx-grid');
    const xlsxBtn = document.querySelector('#xlsxBtn');
    const pdfBtn = document.querySelector('#pdfBtn');
    const csvBtn = document.querySelector('#csvBtn');
    const tsvBtn = document.querySelector('#tsvBtn');
    const xmlBtn = document.querySelector('#xmlBtn');
    const htmlBtn = document.querySelector('#htmlBtn');
    xlsxBtn.addEventListener('click', () => {
    grid.exportData('xlsx');
    });
    pdfBtn.addEventListener('click', () => {
    grid.exportData('pdf');
    });
    csvBtn.addEventListener('click', () => {
    grid.exportData('csv');
    });
    tsvBtn.addEventListener('click', () => {
    grid.exportData('tsv');
    });
    xmlBtn.addEventListener('click', () => {
    grid.exportData('xml');
    });
    htmlBtn.addEventListener('click', () => {
    grid.exportData('html');
    });
    }

    Best regards,
    Peter Stoev
    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.