jQWidgets Forums

jQuery UI Widgets Forums Grid Grid Data Export/Print

Tagged: , ,

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Grid Data Export/Print #49135

    jegj
    Participant

    Hi! I need help please”

    I want to print Grid’s information. I’ve been following the printing example in the demo page, so i export the grid’s data to HTML format, but when i export the data, all field that are date (datafields type), are in blank.

    Now, if i change the datafield’s type from date to string works fine, but i’m using a filtertype of date, and i cannot filter date properly.

    Thanks.

    Grid Data Export/Print #49136

    Peter Stoev
    Keymaster

    Hi jegj,

    Please, provide a sample Fiddle or Web Page which demonstrates your scenario.

    Best Regards,
    Peter Stoev

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

    Grid Data Export/Print #49140

    jegj
    Participant

    ok!

    
    $(document).ready(function () {
                var source =
                {
                    url: '/mywebserver/generateData/'
                    datatype: "json",
                    datafields:
                    [
    	         {name: 'id_cli', type: 'integer'},
    	         {name: 'log_usu', type: 'string'},
    	         {name: 'doc_ide', type: 'string'},
    	         {name: 'nom_cli', type: 'string'},
    	         {name: 'ape_cli', type: 'string'},
    	         {name: 'cli_blo', type: 'bool'},
    	         <strong>{name: 'fec_reg', type: 'date'},</strong>
    	        ]                    
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
                // initialize jqxGrid
                $("#jqxgrid").jqxGrid(
                {
                    width: 670,
                    autoheight: true,
                    source: dataAdapter,                
                    altrows: true,
                    sortable: true,
                    filterable:true,
                    columns: [
                      {name: 'id_cli', type: 'integer'},
           	          {name: 'log_usu', type: 'string'},
    	          {name: 'doc_ide', type: 'string'},
    	          {name: 'nom_cli', type: 'string'},
    	          {name: 'ape_cli', type: 'string'},
    	          {name: 'cli_blo', type: 'bool'},
    	        <strong>  {name: 'fec_reg', type: 'date', filterable: true, filtertype: 'date'},</strong>
                    ]
                });
               $("#print").jqxButton();
             
                $("#print").click(function () {
                    var gridContent = $("#jqxgrid").jqxGrid('exportdata', 'html');
                    var newWindow = window.open('', '', 'width=800, height=500'),
                    document = newWindow.document.open(),
                    pageContent =
                        '<!DOCTYPE html>\n' +
                        '<html>\n' +
                        '<head>\n' +
                        '<meta charset="utf-8" />\n' +
                        '<title>jQWidgets Grid</title>\n' +
                        '</head>\n' +
                        '<body>\n' + gridContent + '\n</body>\n</html>';
                    document.write(pageContent);
                    document.close();
                    newWindow.print();
                });
       });
     

    Using this configuration, dates type are blank in the new window. Now, if i change fec_reg type to string, works fine! but i cannot filter date properly beacuse the field is a string.

    Thanks!.

    Grid Data Export/Print #49142

    Peter Stoev
    Keymaster

    Hi jegj,

    Thanks for the provided code, but we can’t test it, because we do not know what kind of data you display there. In addition, for Date fields, it may be necessary to set the “format” member of the “fec_reg” to point to your Data Source format, too. Btw, there’s no property called “type” for the Grid columns.

    Best Regards,
    Peter Stoev

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

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.