1. #51
    Sencha User
    Join Date
    Aug 2012
    Location
    Dublin
    Posts
    72
    Vote Rating
    11
    iplanit will become famous soon enough

      0  

    Default


    Thanks
    Quote Originally Posted by loiane View Post
    Added Sencha Architect example - in case anyone wants to use it with SA2:

    https://github.com/loiane/extjs4-ux-gridprinter

  2. #52
    Sencha User
    Join Date
    Apr 2012
    Posts
    14
    Vote Rating
    0
    Felipe-BR is on a distinguished road

      0  

    Default


    Loiane! Thanks!

  3. #53
    Sencha User
    Join Date
    Apr 2012
    Location
    Linz, AT
    Posts
    31
    Vote Rating
    1
    drindal is on a distinguished road

      0  

    Default templatecolumn

    templatecolumn


    Hi,
    how can I print a template column?

    my grid column code is:
    Code:
    { 
       xtype:'templatecolumn', 
       tpl:'{NETPR} {WAERS}',
       dataIndex: 'NETPR',
       text: 'Netto'
    },
    i have tried to change the code as descriped earlier in this thread
    Code:
    } else if (column && column.xtype === 'templatecolumn') {
      convertedData[column.dataIndex] = column.tpl ? column.tpl.apply(item.data) : value;
    }
    but it is not working.. it's only showing an empty Netto Column

    I hope someone can help me.
    Thanks.

  4. #54
    Sencha User
    Join Date
    Apr 2012
    Posts
    14
    Vote Rating
    0
    Felipe-BR is on a distinguished road

      0  

    Default


    Loiane! About that bug, i found the error and i fix it.

    Code:
                var dataPrinter = [];
                grid.store.data.each(function(item, row) {
                    var convertedData = {};
                    // apply renderers from column model
                    for (var key in item.data) {
                        var value = item.data[key];
                        Ext.each(columns, function(column, col) {
                                    if (column.dataIndex == key) {
                                        /*
                                         * TODO: add the meta to template
                                         */
                                        var meta = {
                                            item : '',
                                            tdAttr : '',
                                            style : ''
                                        };
                                        value = column.renderer
                                                ? column.renderer.call(grid, value,
                                                        meta, item, row, col,
                                                        grid.store, grid.view)
                                                : value;
                                        varName = Ext.String.createVarName(column.dataIndex);
                                        convertedData[varName] = value;
                                    }
                                }, this);
                    }
                    dataPrinter.push(convertedData);
                });
    Code:
            
    bodyTpl : ['<tpl for=".">',
                    '<td>\{{[Ext.String.createVarName(values.dataIndex)]}\}</td>',
                    '</tpl>']
        }

  5. #55
    Sencha Premium Member
    Join Date
    Sep 2012
    Location
    Argentina
    Posts
    34
    Vote Rating
    1
    grpbhb is on a distinguished road

      0  

    Default


    With RowExpander of Extjs 4.1.2 doesn't work,
    Code:
    Ext.each(grid.plugins, function(p) {
                    if (p.ptype == 'rowexpander') {
                        pluginsBody += p.rowBodyTpl.join(''); //In 4.1.2 rowBodyTpl is a  XTemplate object
                    }
                });
    1- How obtain the compiled template with the data of each record?
    2- I want to show only the expanded rows, not all rows.
    Thanks!

  6. #56
    Sencha User loiane's Avatar
    Join Date
    Aug 2009
    Posts
    183
    Vote Rating
    52
    loiane is a jewel in the rough loiane is a jewel in the rough loiane is a jewel in the rough

      0  

    Default


    Quote Originally Posted by Felipe-BR View Post
    Loiane! About that bug, i found the error and i fix it.
    Thanks Felipe, already committed the fix on github.
    Sencha/Java evangelist
    Author of ExtJS 4 First Look and Mastering Ext JS books
    English blog: http://loianegroner.com
    Portuguese blog: http://loiane.com
    Sencha Examples: https://github.com/loiane

  7. #57
    Sencha User loiane's Avatar
    Join Date
    Aug 2009
    Posts
    183
    Vote Rating
    52
    loiane is a jewel in the rough loiane is a jewel in the rough loiane is a jewel in the rough

      0  

    Default


    Quote Originally Posted by drindal View Post
    Hi,
    how can I print a template column?

    my grid column code is:
    Code:
    { 
       xtype:'templatecolumn', 
       tpl:'{NETPR} {WAERS}',
       dataIndex: 'NETPR',
       text: 'Netto'
    },
    i have tried to change the code as descriped earlier in this thread
    Code:
    } else if (column && column.xtype === 'templatecolumn') {
      convertedData[column.dataIndex] = column.tpl ? column.tpl.apply(item.data) : value;
    }
    but it is not working.. it's only showing an empty Netto Column

    I hope someone can help me.
    Thanks.
    Fixed.
    You can get the new version from github and use.
    Template columns are now supported by the plugin.
    Sencha/Java evangelist
    Author of ExtJS 4 First Look and Mastering Ext JS books
    English blog: http://loianegroner.com
    Portuguese blog: http://loiane.com
    Sencha Examples: https://github.com/loiane

  8. #58
    Sencha User loiane's Avatar
    Join Date
    Aug 2009
    Posts
    183
    Vote Rating
    52
    loiane is a jewel in the rough loiane is a jewel in the rough loiane is a jewel in the rough

      0  

    Default


    Quote Originally Posted by grpbhb View Post
    With RowExpander of Extjs 4.1.2 doesn't work,
    Code:
    Ext.each(grid.plugins, function(p) {
                    if (p.ptype == 'rowexpander') {
                        pluginsBody += p.rowBodyTpl.join(''); //In 4.1.2 rowBodyTpl is a  XTemplate object
                    }
                });
    1- How obtain the compiled template with the data of each record?
    2- I want to show only the expanded rows, not all rows.
    Thanks!
    Sorry. I don't have access to 4.1.2 yet. I only use open source version - educational purposes.
    Sencha/Java evangelist
    Author of ExtJS 4 First Look and Mastering Ext JS books
    English blog: http://loianegroner.com
    Portuguese blog: http://loiane.com
    Sencha Examples: https://github.com/loiane

  9. #59
    Sencha Premium Member
    Join Date
    Sep 2012
    Location
    Argentina
    Posts
    34
    Vote Rating
    1
    grpbhb is on a distinguished road

      0  

    Default


    Ok, but the problem exists!.
    "pluginsBody += p.rowBodyTpl.join('');" only appends tpl, How obtain the compiled template with the data of each record?
    I want to show only the expanded rows.
    Thanks!

  10. #60
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Vote Rating
    0
    CE_REAL is on a distinguished road

      0  

    Default Displaying multiple headers in the printpage

    Displaying multiple headers in the printpage


    Hey I'm using the grid printer plugin and it works great. But now I want to display the header every 30 or so rows. I'm not really that advanced with ExtJS yet so I hope someone can help me breaking up the data to add more than one header.

    Thanks in advance.

    Edit:

    I found a solution for my problem. I added thead and tbody to my output HTML:

    Code:
    '<table>',
                  '<thead>',
                headings,
                '</thead>',
                '<tbody>',
                '<tpl for=".">',
                  body,
                '</tpl>',
                '</tbody>',
    '</table>',
    And then added thead styling to my stylesheet:

    Code:
    thead { display: table-header-group; }
    Which then results in displaying the header on every page that is printed.