[CLOSED] Gridpanel Print Column Adjustment

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Gridpanel Print Column Adjustment

    I am using one of the new feature of EXT.NET and printing my grids very easily. I used to create a pdf file, save it and have user download it (a lot of work...) i loved the new print feature of gridpanel but have one question.

    Before i print the gridpanel how can i adjust the column size and/or disable desired columns on the printed page....
    Last edited by Daniil; Feb 25, 2014 at 3:45 AM. Reason: [CLOSED]
  2. #2
    You can specify columnFilter
    grid.print({
        columnFilter: function (column) {
                //return false here if the column should be excluded from printing
        }
    });
    also you can specify 'columnsWidth' array
    columnsWidth: [100, 200, 400]
  3. #3
    I applied the code that you gave me but i could not get it work, it s still bringing me the column that i have filtered....

      
       <ext:GridPanel runat="server" ID="printpanel" AutoScroll="true" Hidden="true" Header="false">
    
                                <Store>
                                    <ext:Store ID="store3" AutoSync="false" runat="server" DataSourceID="dtsSelectedItems">
                                        <Model>
                                            <ext:Model runat="server" ID="model7" IDProperty="ORD_PRT_ID" Name="Items">
                                                <Fields>
                                                    <ext:ModelField Name="LineNumber" Type="Int"></ext:ModelField>
    
                                                    <ext:ModelField Name="ORD_QUANTITY" Type="String" />
    
                                                    <ext:ModelField Name="PRT_MANF_CODE" Type="String" />
                                                    <ext:ModelField Name="OrdItemStatusTypeName" Type="String" />
                                                    <ext:ModelField Name="PRT_NAME" Type="String" />
                                                    <ext:ModelField Name="PRT_DESC" Type="String" />
                                                    <ext:ModelField Name="PRT_VENDOR_NAME" Type="String" />
                                                    <ext:ModelField Name="UOM_NAME" Type="String" />
                                                    <ext:ModelField Name="PRT_COMMENT" Type="String" />
    
    
    
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
    
                                <ColumnModel runat="server" ID="ColumnModel2">
                                    <Columns>
    
                                        
                                        <ext:Column  runat="server" ID="column34" DataIndex="LineNumber" Hidden="False" Width="35" Text="Line#">
                                            
                                        </ext:Column>
    
    
                                        <ext:Column runat="server" ID="column38" DataIndex="OrdItemStatusTypeName" Width="60"
                                            Text="Approval">
                                        </ext:Column>
    
    
    
    
                                        <ext:Column runat="server" ID="column40" DataIndex="PRT_MANF_CODE" Flex="2" Text="Manf. Part #">
                                        </ext:Column>
                                        <ext:Column runat="server" ID="column41" Flex="4" DataIndex="PRT_NAME" Text="Item">
                                        </ext:Column>
                                        <ext:Column runat="server" ID="column42" Flex="4" DataIndex="PRT_DESC" Text="Description">
                                        </ext:Column>
                                        <%--DataIndex="PRT_VENDOR_NAME"--%>
                                        <ext:Column DataIndex="PRT_VENDOR_NAME" runat="server" ID="column43" Flex="2" Text="Vendor">
                                        </ext:Column>
                                        <ext:Column runat="server" ID="column44" Flex="1" DataIndex="ORD_QUANTITY" Align="Center" Text="Qty">
                                        </ext:Column>
    
                                        <ext:Column runat="server" ID="column45" Flex="1" DataIndex="UOM_NAME" Align="Center" Text="UOM">
                                        </ext:Column>
    
    
    
    
    
                                    </Columns>
                                </ColumnModel>
    
                                <View>
    
                                    <ext:GridView ID="GridView1" runat="server" StripeRows="false">
                                        <%--    <GetRowClass Fn="Coloring" FormatHandler="true" ></GetRowClass>--%>
                                    </ext:GridView>
    
                                </View>
    
                                <Buttons>
                                </Buttons>
    
    
    
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel RowSpan="1" ID="CheckboxSelectionModel2" Mode="Multi" />
    
    
    
                                </SelectionModel>
                                <Plugins>
                                    <ext:CellEditing ID="CellEditing2" runat="server">
                                    </ext:CellEditing>
                                </Plugins>
    
    
                            </ext:GridPanel>
    And here is the code under my print button
                                    <ext:Button ID="btnGridPrint" runat="server" Text="Material R. Form" Icon="Printer" Handler="#{printpanel}.print({columnFilter: function(column40){'False'}});" />
  4. #4
    Your handler is incorrect, you sould use something similar
    #{printpanel}.print({columnFilter: function(c){return c.dataIndex != "PRT_MANF_CODE";}});
  5. #5
    I do not understand the
     function(c)
    do i need to create a javacript function ?
  6. #6
    Yes, columnFilter is javascript function which accepts column as argument, you have to return false from that function if the column should not be printed
  7. #7
    Do you have that function ? any example please ?
  8. #8
    That function depends from your bussines logic, please see my post with example of possible function
    http://forums.ext.net/showthread.php...l=1#post125209
  9. #9
    http://forums.ext.net/showthread.php...l=1#post125209[/QUOTE]

    Link you gave me is redirecting to this page again... I can t see the function example
  10. #10
    Well, Vladimir refers to the post #4 of this thread where he posted a possible solution for you. You can use that code as a Button's Handler.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Portal example adjustment
    By CarWise in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 21, 2013, 12:52 PM
  2. Replies: 13
    Last Post: Aug 29, 2013, 4:54 AM
  3. Print gridpanel with grouping
    By PetrSnobelt in forum 2.x Help
    Replies: 0
    Last Post: May 13, 2013, 1:32 PM
  4. Replies: 6
    Last Post: Feb 18, 2011, 2:12 PM
  5. grid scroll adjustment
    By [WP]joju in forum 1.x Help
    Replies: 1
    Last Post: Oct 29, 2009, 5:24 AM

Tags for this Thread

Posting Permissions