chaya
chaya

Reputation: 433

How to export the data to excel using jquery jtable in php

I want to export the data to excel using jquery jtable, I have tried but I am not getting how to export the data to excel.

I have mentioned the click event in toolbar, inside that click event what are the steps I have to follow please suggest me.

$('#EmpDetResult').jtable({
    title: 'Table of people',
    paging: true,
    toolbar: {
        items: [{
            tooltip: 'Click here to export this table to excel',
            text: 'Export to Excel',
            click: function () {
              "EVENT HERE"
            }
        }]
    },
    actions: {
        listAction: 'getResult.php?formName=afscpEmp&action=test',
        updateAction:'getResult.php?formName=afscpEmp&action=test',
        deleteAction:'getResult.php?formName=afscpEmp&action=test'
    }
});

Upvotes: 0

Views: 3134

Answers (1)

chaya
chaya

Reputation: 433

toolbar: {
    items: [{
        Tooltip: 'Click here to export this table to excel',
        //icon: '/images/paginate.gif',
        text: 'Export to Excel',
        click: function () {
            window.location = 'getResult.php?formName=afscpEmp&action=export-excel';
            e.preventDefault();
        }
    }]
},

Upvotes: 1

Related Questions