i am using on mvc project a jqgrid, i want to export the grid to excel.
my actual code:
@section scripts{
<script type="text/javascript">
$(document).ready(function () {
function search() {
var config = {
datatype: "json",
datafields: [
{ name: "CompanyName", type: "string" },
{ name: "StoreName", type: "string" },
{ name: "ComputerName", type: "string" },
{ name: "IP1", type: "string" },
{ name: "logiPOS_Version", type: "string" },
{ name: "LastModifiedDate", type: "string" },
{ name: "LocationId", type: "string" },
{ name: "SynchronisedDate", type: "string" }
],
url: "/Home/GetIMScompinfo?CompanyName=" + $("#CompanyName").val() + "&StoreName=" + $("#StoreName").val() + "&ComputerName=" + $("#ComputerName").val() + "&LocationId=" + $("#LocationId").val()
};
var dataAdapter = new $.jqx.dataAdapter(config);
$("#JxGrid").jqxGrid({
source: dataAdapter,
pageable: true,
sortable: true,
columnsreorder: true,
columnsresize: true,
filterable: true,
width: '100%',
height: "100%",
columns: [
{ text: "CompanyName", datafield: "CompanyName", width: 100 },
{ text: "StoreName", datafield: "StoreName", width: 150 },
{ text: "ComputerName", filtertype: 'checkedlist', datafield: "ComputerName", width: 150 },
{ text: "IP1", columntype: 'textbox', filtertype: 'input', datafield: "IP1", width:150},
{ text: "logiPOS_Version", datafield: "logiPOS_Version", width: 100 },
{ text: "LastModifiedDate", datafield: "LastModifiedDate", width: 160 },
{ text: "LocationId", datafield: "LocationId", width: 150 },
{ text: "SynchronisedDate", datafield: "SynchronisedDate", width: 160 }
],
groupable:
true,
});
}
});
</script>
}