jQWidgets Forums

jQuery UI Widgets Forums Grid XLS Export: s is null

This topic contains 15 replies, has 6 voices, and was last updated by  agelospanagiotakis 10 years, 11 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
  • XLS Export: s is null #24320

    Robin Kluth
    Member
    TypeError: s is null
    ...="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="'+s["border-color"]+'"/... @ jqxdata.export.js

    appears if I try to export a grid via jqxButtons to Excel. CSV, JSON, XML, HTML, … is working great – except XLS.

    Any hint on that?

    Export:

    $("#excelExport").jqxButton({ theme: theme, width: '150' });
    $("#excelExport").click(function () {
    $("#jqxGrid").jqxGrid('exportdata', 'xls', 'jqxGrid');
    });

    Do you need further informations?

    Thanks in advance!

    XLS Export: s is null #24322

    Peter Stoev
    Keymaster

    Hi,

    We do not know what could be the reason about such behavior on your side. If you experience an issue, then post a sample which demonstrates it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    XLS Export: s is null #24378

    Robin Kluth
    Member

    Okay, this example does not work (at least for me):

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <!-- mobile viewport optimisation -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- stylesheets -->
    <link rel="stylesheet" href="js/jqwidgets/styles/jqx.base.css?2013070308" type="text/css" />
    <link rel="stylesheet" href="js/jqwidgets/styles/jqx.energyblue.css?2013070308" type="text/css" />
    <!-- jQuery -->
    <script type="text/javascript" src="js/jqwidgets/scripts/jquery-1.10.1.min.js?2013070308"></script>
    <!-- jqWidgets -->
    <script type="text/javascript" src="js/jqwidgets/jqxcore.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/scripts/gettheme.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxdata.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxdata.export.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxnavigationbar.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxbuttons.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxscrollbar.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxmenu.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxgrid.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxgrid.selection.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxgrid.columnsresize.js?2013070308"></script>
    <script type="text/javascript" src="js/jqwidgets/jqxgrid.export.js?2013070308"></script>
    </head><body> <script type="text/javascript">
    $(document).ready(function () {
    var theme = 'energyblue'
    var source =
    {
    datatype: "json",
    id: 'id',
    localdata: [{"proddb":null,"title":"test","id":"203"}]
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    // initialize jqxGrid
    $("#jqxGrid").jqxGrid(
    {
    width: 800,
    height: 500,
    theme: theme,
    source: dataAdapter,
    altrows: true,
    sortable: false,
    columns: [
    { text: 'Titel', datafield: 'title'},
    { text: 'Keywords', datafield: 'proddb' }
    ]
    });
    $("#jqxNavigationBar").jqxNavigationBar({ theme: theme, expandMode: 'multiple', expandedIndexes: [0] });
    $("#excelExport").jqxButton({ theme: theme, width: '150' });
    $("#htmlExport").jqxButton({ theme: theme, width: '150' });
    $("#excelExport").click(function () {
    $("#jqxGrid").jqxGrid('exportdata', 'xls', 'FATSearch-ExcelExport');
    });
    $("#htmlExport").click(function () {
    $("#jqxGrid").jqxGrid('exportdata', 'html', 'FATSearch-HTMLExport');
    });
    });
    </script>
    <input type="button" value="Excel Export" id="excelExport" />
    <input type="button" value="HTML Export" id="htmlExport" />
    <div id='jqxNavigationBar'>
    <div style="width: 80%">
    Early History of the Internet</div>
    <div>
    <div id="jqxGrid">
    </div>
    </div>
    </div>
    </body></html>

    I hope you can reproduce it or/and give me a hint 😉

    XLS Export: s is null #24380

    Peter Stoev
    Keymaster

    Hi,

    You did not initialized the datafields array in this code. Each datafield in that array must have “name” and “type” members.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    XLS Export: s is null #24383

    Robin Kluth
    Member

    Thanks for that hint!

    Yep, that was the reason – Very weird error on the Grids side.

    Thanks!

    XLS Export: s is null #24395

    Robin Kluth
    Member

    Another thing:

    If a datafield (in my case type: string) contains any HTML-character, the created xls is defective:

    If I open it, Excel say that the Sheet 1 is damaged and generate me an error log:

    XML PARSE ERROR: Extraneous end-tag
    Error occurs at or below this element stack:
    <ss:Workbook>
    <ss:Worksheet>
    <ss:Table>
    <ss:Row>
    <ss:Cell>
    <ss:Data>

    As soon as I fill the grid with Text with HTML in it (like: This is a text), the created xls will not work:

    That worked in previous versions of jqwidgets.

    Is that a correct behaviour? I mean: Is HTML not allowed here anymore?

    XLS Export: s is null #24779

    Robin Kluth
    Member

    Sorry for pushing that – Do you have any idea why it is not working anymore?

    Thanks in advance!

    XLS Export: s is null #25266

    gaclique
    Participant

    I too am having the same issue with exporting to excel. I have initialized the datafields array with name and type but i still get the “s is null” error when exporting. My export was working fine on v 2.8.3 but is no longer working on v 2.9.3.

    My grid do include a status bar with aggregates. Not sure if that causes any issues but that’s the only thing i can think of that is different than the previous posters grid declaration.

    XLS Export: s is null #25271

    Peter Stoev
    Keymaster

    Hi,

    Please, post a sample which demonstrates your scenario with the current version. Also note that this topic it not about the current version.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    XLS Export: s is null #25278

    gaclique
    Participant

    Below is the code

    <script type="text/javascript">
    var dataAdapter;
    var selectedCycle = 0;
    var selectedConference = "";
    $(function () {
    var source = { datatype: "json",
    datafields: [
    { name: 'ActivityDetailId', type: 'int' },
    { name: 'ActivityId', type: 'int' },
    { name: 'Name', type: 'string' },
    { name: 'Title', type: 'string' },
    { name: 'CategoryId', type: 'number' },
    { name: 'Credits', type: 'number' }
    ],
    data: {UserId: @Model.UserId, CycleId: selectedCycle, Conference: selectedConference},
    url: 'GetActivities',
    id: 'ActivityDetailId',
    type: 'POST'
    };
    dataAdapter = new $.jqx.dataAdapter(source);
    $("#transcriptGrid").jqxGrid(
    {
    theme: DEFAULT_THEME,
    width: 900,
    height: 300,
    source: dataAdapter,
    //pageable: false,
    pageable: true,
    pagesize: 5,
    pagesizeoptions : ['5','10','20'],
    columnsresize: true,
    filterable: true,
    sortable: true,
    showfiltercolumnbackground: false,
    showsortcolumnbackground: false,
    autoshowfiltericon: true,
    showstatusbar: true,
    statusbarheight: 120,
    showaggregates: true,
    columnsheight: 40,
    autoheight: true,
    autorowheight: true,
    selectionmode: 'none',
    enablehover: false,
    columns: [
    { text: 'Name', datafield: 'Name', width: 100, cellsalign: 'center', align: 'center' },
    { text: 'Activity Title', datafield: 'Title', width: 250, cellsalign: 'left', align: 'center' },
    {
    text: 'Credits', datafield: 'Credits', width: 70, cellsalign: 'right', align: 'right', cellsformat: 'F2',
    aggregates: ['sum',
    {
    'Totals': function (aggregatedValue, currentValue, column, record) {
    if (record['CategoryId'] == "1" && typeof( currentValue)!='undefined')
    return parseFloat(currentValue) + parseFloat(aggregatedValue)
    else if( typeof( aggregatedValue)!='undefined')
    return parseFloat(aggregatedValue)
    else
    return 0
    }
    }
    ],
    aggregatesrenderer: function (aggregates, column, element, summaryData) {
    var renderstring = "";
    $.each(aggregates, function (key, value) {
    renderstring += '<div style="position: relative; margin: 4px; text-align: right; overflow: hidden;">' + value + '</div>';
    });
    return renderstring;
    }
    },
    { text: 'Cat', datafield: 'CategoryId', width: 50, cellsalign: 'center', align: 'center', filterable: false }
    ]
    });
    $("#exportExcel").click(function () {
    $("#transcriptGrid").jqxGrid('exportdata', 'xls');
    return false;
    });
    });
    </script>
    <div id='jqxWidget' class='gridstyle' style="margin-top:20px">
    <div style="margin-top:20px">
    <a href="#" id="exportExcel"><img src="/Images/excel.png" title="Export to Excel" /></a>
    </div>
    <div id="transcriptGrid">
    </div>
    </div>
    XLS Export: s is null #25336

    Peter Stoev
    Keymaster

    Hi,

    The $(“#transcriptGrid”).jqxGrid(‘exportdata’, ‘xls’); code will export the Grid to a local variable which is missing, too. To export a Grid to a file, you should provide the file’s name as 2nd parameter when you call “exportdata”.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    XLS Export: s is null #25349

    gaclique
    Participant

    Yep, had that parameter in as well and still get the error.

    $("#exportExcel").click(function () {
    $("#transcriptGrid").jqxGrid('exportdata', 'xls', 'Transcript');
    return false;
    });
    XLS Export: s is null #25354

    Peter Stoev
    Keymaster

    Hi,

    Sorry, we cannot find an issue on our side with the current version. Neither do the provided sample demonstrates such. It should be most probably something related to the data that you try to export, but unfortunately such is not provided for testing.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    XLS Export: s is null #28938

    Fabio
    Participant

    The grid does not export to xls the cells having NULL value.
    A workaround of the problem is inserting a “.” in the cells, then they will be exported correctly in xls

    XLS Export: s is null #29003

    timo75
    Participant

    I can confirm the problem exists with NULL values.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.