Export datagrid to excel using Jquery Easyui

人走茶凉 提交于 2019-11-30 02:32:24

In your examexport.php, change $_POST to $_GET and use the following function:

<input type="button" onclick="exportExcel()" value="Export to Excel " />
<script>
    function exportExcel() {
        var row=$('#dg').datagrid('getData');//to get the loaded data
        if (row) {
            url = "excel/examexport.php?entry="+$('#entry').val()+"&
                   semester="+$('#semester').val()+"&batch="+$('#batch').val();
            window.open(url);
            }
    }
 </script>

For final word, please go through http://www.jeasyui.com/documentation/index.php. they have good documentation.

$("#btnExport").click(function(e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent($('#dg').html()));
e.preventDefault(); });

you can use just simple jquery code. you should add jquery library on your file.​

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!