Grid Print problem

  1. #1

    Grid Print problem

    Hello everyone!
    I have a web site developed in ASP.net web forms
    On every page I have included a grid panel, where each has built-in functionality to print the contents of the grid.
    The problem arises when I print the grid, it does not show correctly the date format specified in the ColumnModel of the grid.

    To be more clear, I describe an example:
    1 - When I set the store model, I specify the column as date type with format that comes directly from the database as "yyyy-MM-DDThh:mm:ss".



    2 - Then when I set the column model, I define that column as DateColumn type with the format "dd/MM/yyyy", which is coming out correctly on screen.



    3 - When I run the application and visualize the grid, the formatted dates correctly output (dd/MM/yyyy)



    4 - But when I use the print grid functionality, the preview shows another date format, which I suspect is the default format (MM/dd/yyyy).



    Try to modify the property "Locale" within tag ResourceManager but does not change anything.
    Try to change various Date Formats into the ColumnModel and Store Model, but no effect.
    Can I specify the date format I want the grid to be shown on print?


    Ext.NET WebForms 2.3.1
    MS Visual Studio 2010

    Any help is welcome.
    Thanks in advance!
    Sebastian
    Attached Thumbnails Click image for larger version. 

Name:	Store Model Definition.png 
Views:	59 
Size:	2.7 KB 
ID:	15551   Click image for larger version. 

Name:	Grid Column Model.png 
Views:	56 
Size:	4.5 KB 
ID:	15561   Click image for larger version. 

Name:	GridPanel View.png 
Views:	59 
Size:	4.9 KB 
ID:	15571   Click image for larger version. 

Name:	Print Grid View.png 
Views:	53 
Size:	3.6 KB 
ID:	15572  
    Last edited by SebasVT; Oct 15, 2014 at 4:04 PM.
  2. #2
    Hi @SebasVT,

    Welcome to the Ext.NET forums!

    Could you, please, test it with Ext.NET v2.5.2?

    I remember something like that has been fixed.

    If it is reproducible with v2.5.2, please post a standalone test case, I will test with the latest from SVN.
  3. #3
    Ok Daniil,
    I'll try that and notice you if the problem is solved.

    Thank you very much!
  4. #4
    Daniil,
    I tried your suggestion but still all the same, the bug is reproducible in v2.5.2.
    Attached a full test case

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Store1.DataSource = this.Data;
                this.Store1.DataBind();
            }
        }
    
        private object[] Data
        {
            get
            {
                return new object[]
                {
                    new object[] { "3m Co", 71.72, 0.02, 0.03, "2014-09-04 00:00:00.000" },
                    new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "2014-09-30 00:00:00.000" },
                    new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "2014-09-16 00:00:00.000" },
                    new object[] { "American Express Company", 52.55, 0.01, 0.02, "2014-09-26 00:00:00.000" },
                    new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "2014-09-17 00:00:00.000" },
                    new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "2014-10-16 00:00:00.000" },
                    new object[] { "Boeing Co.", 75.43, 0.53, 0.71, "2014-10-16 00:00:00.000" },
                    new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39, "2014-09-16 00:00:00.000" },
                    new object[] { "Citigroup, Inc.", 49.37, 0.02, 0.04, "2014-09-23 00:00:00.000" },
                    new object[] { "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, "2014-09-16 00:00:00.000" },
                    new object[] { "Exxon Mobil Corp", 68.1, -0.43, -0.64, "2014-09-17 00:00:00.000" },
                    new object[] { "General Electric Company", 34.14, -0.08, -0.23, "2014-09-08 00:00:00.000" },
                    new object[] { "General Motors Corporation", 30.27, 1.09, 3.74, "2014-09-17 00:00:00.000" },
                    new object[] { "Hewlett-Packard Co.", 36.53, -0.03, -0.08, "2014-09-23 00:00:00.000" },
                    new object[] { "Honeywell Intl Inc", 38.77, 0.05, 0.13, "2014-09-08 00:00:00.000" },
                    new object[] { "Intel Corporation", 19.88, 0.31, 1.58, "2014-09-23 00:00:00.000" },
                    new object[] { "International Business Machines", 81.41, 0.44, 0.54, "2014-10-01 00:00:00.000" },
                    new object[] { "Johnson & Johnson", 64.72, 0.06, 0.09, "2014-10-01 00:00:00.000" },
                    new object[] { "JP Morgan & Chase & Co", 45.73, 0.07, 0.15, "2014-09-09 00:00:00.000" },
                    new object[] { "McDonald\"s Corporation", 36.76, 0.86, 2.40, "2014-09-26 00:00:00.000" },
                    new object[] { "Merck & Co., Inc.", 40.96, 0.41, 1.01, "2014-09-26 00:00:00.000" },
                    new object[] { "Microsoft Corporation", 25.84, 0.14, 0.54, "2014-10-15 00:00:00.000" },
                    new object[] { "Pfizer Inc", 27.96, 0.4, 1.45, "2014-09-23 00:00:00.000" },
                    new object[] { "The Coca-Cola Company", 45.07, 0.26, 0.58, "2014-10-15 00:00:00.000" },
                    new object[] { "The Home Depot, Inc.", 34.64, 0.35, 1.02, "2014-09-26 00:00:00.000" },
                    new object[] { "The Procter & Gamble Company", 61.91, 0.01, 0.02, "2014-10-15 00:00:00.000" },
                    new object[] { "United Technologies Corporation", 63.26, 0.55, 0.88, "2014-10-15 00:00:00.000" },
                    new object[] { "Verizon Communications", 35.57, 0.39, 1.11, "2014-09-09 00:00:00.000" },
                    new object[] { "Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, "2014-09-09 00:00:00.000" }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Test Print Grid v2.5.2</title>
        
        <style type="text/css">
            .x-grid-row-over .x-grid-cell-inner {
                font-weight : bold;
            }
        </style>
    
        <script type="text/javascript">
            var template = '<span style="color:{0};">{1}</span>';
    
            var change = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value);
            };
    
            var pctChange = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
            };
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        
        <h1>Test Print Grid v2.5.2</h1>
        <h2>Displayed grid date format (dd/MM/yyyy) is not the same as printed grid date format (MM/dd/yyyy)</h2>
        <ext:GridPanel 
            ID="GridPanel1"
            runat="server" 
            Title="Test Print Grid v2.5.2" 
            Width="600" 
            Height="350">
            <Store>
                <ext:Store ID="Store1" runat="server">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="company" />
                                <ext:ModelField Name="price" Type="Float" />
                                <ext:ModelField Name="change" Type="Float" />
                                <ext:ModelField Name="pctChange" Type="Float" />
                                <ext:ModelField Name="lastChange" Type="Date" DateFormat="c" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel>
                <Columns>
                    <ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
                    <ext:Column runat="server" Text="Price" DataIndex="price">                  
                        <Renderer Format="UsMoney" />
                    </ext:Column>
                    <ext:Column runat="server" Text="Change" DataIndex="change">
                        <Renderer Fn="change" />
                    </ext:Column>
                    <ext:Column runat="server" Text="Change" DataIndex="pctChange">
                        <Renderer Fn="pctChange" />
                    </ext:Column>
                    <ext:DateColumn runat="server" Text="Last Updated" DataIndex="lastChange" Format="dd/MM/yyyy" />
                </Columns>            
            </ColumnModel>       
            <SelectionModel>
                <ext:RowSelectionModel runat="server" />
            </SelectionModel>
            <BottomBar>
                <ext:Toolbar runat="server">
                    <Items>
                        <ext:Button runat="server" Text="Print" Icon="Printer" Handler="this.up('grid').print();" />
                    </Items>
                </ext:Toolbar>
            </BottomBar>
        </ext:GridPanel>
    
        
    </body>
    </html>
  5. #5
    Thank you for the test case. It is a bug. Created an Issue.
    https://github.com/extnet/Ext.NET/issues/573

    Fixed in the SVN trunk, in the revision #6047. This will go outside with Ext.NET v2.5.3 release.
  6. #6
    Thank you Daniil for your quick answer!
    I wait for v2.5.3

    Greetings!
    Sebastian.-
  7. #7
    I wait for v2.5.3
    You can also buy a Premium Support Subscription;)
  8. #8
    You can also buy a Premium Support Subscription;)
    Of course, it's in my next budget! ;)
  9. #9
    Daniil,
    I tested this issue and I can confirm you that the bug is fixed in v2.5.3.
    Please mark it as closed.

    Thank you!
  10. #10
    Thank you for the confirmation!

Similar Threads

  1. [CLOSED] Grid panel print in mvc
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 27, 2014, 7:42 PM
  2. [CLOSED] [#514] Print Grid With FilterHeader
    By snow_cap in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 29, 2014, 7:35 PM
  3. Print Tree Panel Icons visibility Problem
    By ITECH-Developer in forum 1.x Help
    Replies: 0
    Last Post: Sep 01, 2013, 8:16 AM
  4. [CLOSED] Print a grid panel javascript error
    By otouri in forum 2.x Legacy Premium Help
    Replies: 19
    Last Post: Nov 01, 2012, 6:30 PM
  5. Replies: 6
    Last Post: Feb 18, 2011, 2:12 PM

Tags for this Thread

Posting Permissions