I am adding an export to excel feature to an already existing (and functional) web page.
The JavaScript to export my RadGrid:
function onRequestStart(sender, args) {
if (isExporting) {
args.set_enableAjax(false);
}
}
function exportToExcel(sender, args) {
console.log("Made it here!");
isExporting = true;
var masterTable = $find('<%= MyGrid.ClientID %>').get_masterTableView();
console.log(masterTable);
masterTable.exportToExcel();
console.log(masterTable.exportToExcel());
isExporting = false;
}
The RadGrid that is created comes from a separate JS file, so not sure what to show here except for the radgrid creation line I guess. The file that all of this code exists in is a .aspx file.
<telerik:RadGrid ID="MyGrid" runat="server" AutoGenerateColumns="false" Width="100%" Height="100%" AllowSorting="true">
<ClientSettings EnablePostBackOnRowClick="false>
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
<Selecting AllowRowSelect="true" />
<ClientEvents OnCommand="function(sender,args) { myLibrary.mainGrid.onGridCommand(sender, args) }"
OnRowDataBound="function(sender,args) { mylibrary.mainGrid.onRowDatabound(sender,args) }"
OnRowClick="function(sender,args) { mylibrary.mainGrid.onRowClick(sender,args) }"
onRowMouseOut="function(sender,args) { mylibrary.mainGrid.onRowMouseOut(sender,args)}"/>
</ClientSettings>
<MasterTableView CommandItemDisplay="None" ClientDataKeyNames="Cant share these :)" TableLayout="Auto"
AllowPaging="true" PageSize="20">
... fill out table with <NoRecordsTemplate>, <PagerStyle>, <Columns>
</MasterTableView>
</telerik:RadGrid>
The issue:
When my function gets called I log stuff to see what happens on the inside...
- I see the "Made it Here!"
- I see the masterTable variable get filled with data that seems correct. Main thing here Im guessing is the portion of it labeled _dataSource and _dataItems.
- Then I see a false for the value for masterTable.exportToExcel();
Why is the false being shown for a variable that seems to contain the important information?